nuxt.config.js 2.8 KB

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