nuxt.config.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: ['@/plugins/vant', '@/plugins/axios', '@/plugins/vue-filters'],
  34. // Auto import components: https://go.nuxtjs.dev/config-components
  35. components: true,
  36. // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  37. buildModules: [
  38. // https://go.nuxtjs.dev/tailwindcss
  39. '@nuxtjs/tailwindcss',
  40. ],
  41. // Modules: https://go.nuxtjs.dev/config-modules
  42. modules: [
  43. // https://go.nuxtjs.dev/axios
  44. '@nuxtjs/axios',
  45. ],
  46. // Axios module configuration: https://go.nuxtjs.dev/config-axios
  47. axios: {
  48. // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
  49. baseURL: envConfig.parsed.BASE_URL,
  50. },
  51. // Build Configuration: https://go.nuxtjs.dev/config-build
  52. build: {
  53. extractCSS: true,
  54. filenames: {
  55. chunk: ({ isDev }) => (isDev ? '[name].js' : '[id].[contenthash].js'),
  56. },
  57. },
  58. // 配置 Nuxt.js 应用是开发模式还是生产模式
  59. dev: process.env.NODE_ENV !== 'production',
  60. // 配置在客户端和服务端共享的环境变量
  61. env: {
  62. ...process.env,
  63. ...envConfig.parsed,
  64. },
  65. server: {
  66. port: process.env.PORT,
  67. host: process.env.HOST,
  68. },
  69. }