nuxt.config.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import path from 'path'
  2. import fs from 'fs'
  3. console.log(process.env.BASE_URL)
  4. export default {
  5. router: {
  6. middleware: ['intercept'],
  7. },
  8. // Global page headers: https://go.nuxtjs.dev/config-head
  9. head: {
  10. title: '认证通',
  11. htmlAttrs: {
  12. lang: 'zh-cn',
  13. },
  14. meta: [
  15. { charset: 'utf-8' },
  16. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  17. { name: 'description', content: '认证通|一款专业的正品认证SaaS软件系统' },
  18. { name: 'format-detection', content: 'telephone=no' },
  19. ],
  20. // link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  21. script: [
  22. process.env.NODE_ENV === 'production'
  23. ? {
  24. src: '/baidu.count.js',
  25. }
  26. : '',
  27. {
  28. src: '/map.config.js',
  29. },
  30. {
  31. src: 'https://webapi.amap.com/maps?v=2.0&key=eae3be059db26dc1f9cae1d1bee9d4cb',
  32. },
  33. {
  34. src: 'https://api.map.baidu.com/api?v=2.0&&type=webgl&ak=9kNcqnkFxlS0Kv9jEbDgwG2BAMrD6wPb',
  35. },
  36. {
  37. src: 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js',
  38. },
  39. ],
  40. },
  41. // Global CSS: https://go.nuxtjs.dev/config-css
  42. css: [
  43. // 'vant/lib/index.css',
  44. // 'element-ui/lib/theme-chalk/index.css',
  45. '~/assets/css/iconfont.css',
  46. 'swiper/css/swiper.css',
  47. 'animate.css/animate.min.css',
  48. '~/assets/css/global.css',
  49. 'three-dots/dist/three-dots.min.css',
  50. ],
  51. // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  52. plugins: [
  53. '~/plugins/vant',
  54. '~/plugins/element-ui',
  55. '~/plugins/axios',
  56. '~/plugins/vue-filters',
  57. '~/plugins/storage',
  58. '~/plugins/jssdk',
  59. '~/plugins/router',
  60. ],
  61. // Auto import components: https://go.nuxtjs.dev/config-components
  62. components: true,
  63. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  64. buildModules: [
  65. '@nuxtjs/style-resources',
  66. // https://go.nuxtjs.dev/tailwindcss
  67. '@nuxtjs/tailwindcss',
  68. ],
  69. // Modules: https://go.nuxtjs.dev/config-modules
  70. modules: [
  71. // https://go.nuxtjs.dev/axios
  72. '@nuxtjs/axios',
  73. ],
  74. // Axios module configuration: https://go.nuxtjs.dev/config-axios
  75. axios: {
  76. // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
  77. baseURL: process.env.BASE_URL,
  78. },
  79. styleResources: {
  80. scss: ['~/assets/css/utils.scss', '~/assets/themes/themeMixin.scss'],
  81. },
  82. // Build Configuration: https://go.nuxtjs.dev/config-build
  83. build: {
  84. extractCSS: true,
  85. filenames: {
  86. chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js'),
  87. },
  88. },
  89. // 配置 Nuxt.js 应用是开发模式还是生产模式
  90. dev: process.env.NODE_ENV !== 'production',
  91. // 配置在客户端和服务端共享的环境变量
  92. env: {
  93. ...process.env,
  94. },
  95. server: {
  96. port: process.env.PORT,
  97. host: process.env.HOST,
  98. https:
  99. process.env.HTTPS === 'true'
  100. ? {
  101. key: fs.readFileSync(path.join(__dirname, 'cert.key')),
  102. cert: fs.readFileSync(path.join(__dirname, 'cert.crt')),
  103. }
  104. : null,
  105. },
  106. log: {
  107. level: 'debug'
  108. }
  109. }