nuxt.config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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: '/map.config.js',
  23. },
  24. {
  25. src: 'https://webapi.amap.com/maps?v=2.0&key=eae3be059db26dc1f9cae1d1bee9d4cb',
  26. },
  27. {
  28. src: 'https://api.map.baidu.com/api?v=2.0&&type=webgl&ak=9kNcqnkFxlS0Kv9jEbDgwG2BAMrD6wPb'
  29. }
  30. ],
  31. },
  32. // Global CSS: https://go.nuxtjs.dev/config-css
  33. css: [
  34. 'vant/lib/index.css',
  35. 'element-ui/lib/theme-chalk/index.css',
  36. 'swiper/css/swiper.css',
  37. 'animate.css/animate.min.css',
  38. '~/assets/css/global.css',
  39. ],
  40. // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  41. plugins: [
  42. '~/plugins/vant',
  43. '~/plugins/element-ui',
  44. '~/plugins/axios',
  45. '~/plugins/vue-filters',
  46. '~/plugins/storage',
  47. ],
  48. // Auto import components: https://go.nuxtjs.dev/config-components
  49. components: true,
  50. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  51. buildModules: [
  52. '@nuxtjs/style-resources',
  53. // https://go.nuxtjs.dev/tailwindcss
  54. '@nuxtjs/tailwindcss',
  55. ],
  56. // Modules: https://go.nuxtjs.dev/config-modules
  57. modules: [
  58. // https://go.nuxtjs.dev/axios
  59. '@nuxtjs/axios',
  60. ],
  61. // Axios module configuration: https://go.nuxtjs.dev/config-axios
  62. axios: {
  63. // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
  64. baseURL: process.env.BASE_URL,
  65. },
  66. // Build Configuration: https://go.nuxtjs.dev/config-build
  67. build: {
  68. extractCSS: true,
  69. filenames: {
  70. chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js'),
  71. },
  72. styleResources: {
  73. scss: '~/assets/themes/themeMixin.scss',
  74. },
  75. },
  76. // 配置 Nuxt.js 应用是开发模式还是生产模式
  77. dev: process.env.NODE_ENV !== 'production',
  78. // 配置在客户端和服务端共享的环境变量
  79. env: {
  80. ...process.env,
  81. },
  82. server: {
  83. port: process.env.PORT,
  84. host: process.env.HOST,
  85. https:
  86. process.env.HTTPS === 'true'
  87. ? {
  88. key: fs.readFileSync(path.join(__dirname, 'cert.key')),
  89. cert: fs.readFileSync(path.join(__dirname, 'cert.crt')),
  90. }
  91. : null,
  92. },
  93. }