nuxt.config.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // import generateRoutes from './generate'
  2. // const list = [
  3. // { id: 113, type: 'ldm' },
  4. // { id: 102, type: 'app' },
  5. // { id: 62, type: 'app' },
  6. // ]
  7. // const routes = generateRoutes(list, '_template')
  8. // 运行环境
  9. const envConfig = require('dotenv').config({
  10. path: `.env${process.env.ENV ? `.${process.env.ENV}` : ''}`,
  11. })
  12. export default {
  13. // generate: {
  14. // routes: routes,
  15. // },
  16. // Global page headers: https://go.nuxtjs.dev/config-head
  17. head: {
  18. title: '认证通',
  19. htmlAttrs: {
  20. lang: 'zh-cn',
  21. },
  22. meta: [
  23. { charset: 'utf-8' },
  24. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  25. { name: 'description', content: '认证通|一款专业的正品认证SaaS软件系统' },
  26. { name: 'format-detection', content: 'telephone=no' },
  27. ],
  28. // link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
  29. },
  30. // Global CSS: https://go.nuxtjs.dev/config-css
  31. css: ['vant/lib/index.css', 'swiper/css/swiper.css'],
  32. // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  33. plugins: [
  34. '@/plugins/vant',
  35. '@/plugins/axios',
  36. '@/plugins/vue-filters',
  37. '@/plugins/storage',
  38. ],
  39. // Auto import components: https://go.nuxtjs.dev/config-components
  40. components: true,
  41. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  42. buildModules: [
  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. },
  63. // 配置 Nuxt.js 应用是开发模式还是生产模式
  64. dev: process.env.NODE_ENV !== 'production',
  65. // 配置在客户端和服务端共享的环境变量
  66. env: {
  67. ...process.env,
  68. ...envConfig.parsed,
  69. },
  70. server: {
  71. port: process.env.PORT,
  72. host: process.env.HOST,
  73. },
  74. }