nuxt.config.js 1.9 KB

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