nuxt.config.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // 运行环境
  2. const envConfig = require('dotenv').config({
  3. path: `.env${process.env.ENV ? `.${process.env.ENV}` : ''}`,
  4. })
  5. export default {
  6. router: {
  7. middleware: 'auth',
  8. },
  9. // Global page headers: https://go.nuxtjs.dev/config-head
  10. head: {
  11. title: '认证通',
  12. htmlAttrs: {
  13. lang: 'zh-cn',
  14. },
  15. meta: [
  16. { charset: 'utf-8' },
  17. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  18. { name: 'description', content: '认证通|一款专业的正品认证SaaS软件系统' },
  19. { name: 'format-detection', content: 'telephone=no' },
  20. ],
  21. // link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  22. },
  23. // Global CSS: https://go.nuxtjs.dev/config-css
  24. css: [
  25. 'vant/lib/index.css',
  26. 'element-ui/lib/theme-chalk/index.css',
  27. 'swiper/css/swiper.css',
  28. '@/styles/global.css',
  29. ],
  30. // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  31. plugins: [
  32. '@/plugins/vant',
  33. '@/plugins/element-ui',
  34. '@/plugins/axios',
  35. '@/plugins/vue-filters',
  36. '@/plugins/storage',
  37. ],
  38. // Auto import components: https://go.nuxtjs.dev/config-components
  39. components: true,
  40. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  41. buildModules: [
  42. '@nuxtjs/style-resources',
  43. // https://go.nuxtjs.dev/tailwindcss
  44. '@nuxtjs/tailwindcss',
  45. ],
  46. // Modules: https://go.nuxtjs.dev/config-modules
  47. modules: [
  48. // https://go.nuxtjs.dev/axios
  49. '@nuxtjs/axios',
  50. ],
  51. // Axios module configuration: https://go.nuxtjs.dev/config-axios
  52. axios: {
  53. // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
  54. baseURL: envConfig.parsed.BASE_URL,
  55. },
  56. // Build Configuration: https://go.nuxtjs.dev/config-build
  57. build: {
  58. extractCSS: true,
  59. filenames: {
  60. chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js'),
  61. },
  62. styleResources: {
  63. scss: './themes/themeMixin.scss',
  64. },
  65. },
  66. // 配置 Nuxt.js 应用是开发模式还是生产模式
  67. dev: process.env.NODE_ENV !== 'production',
  68. // 配置在客户端和服务端共享的环境变量
  69. env: {
  70. ...process.env,
  71. ...envConfig.parsed,
  72. },
  73. server: {
  74. port: process.env.PORT,
  75. host: process.env.HOST,
  76. },
  77. }