nuxt.config.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. export default {
  2. mode: 'universal',
  3. /*
  4. ** Headers of the page
  5. */
  6. head: {
  7. title: process.env.npm_package_name || '',
  8. meta: [
  9. { name: "referrer", content: "same-origin"},
  10. { charset: 'utf-8' },
  11. { name: 'viewport', content: 'width=device-width, initial-scale=1' },
  12. { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
  13. ],
  14. script: [
  15. {
  16. src: '/qrcode.js'
  17. }
  18. ]
  19. },
  20. telemetry: false,
  21. /*
  22. ** Customize the progress-bar color
  23. */
  24. loading: false,
  25. /*
  26. ** Global CSS
  27. */
  28. css: [
  29. '~/assets/css/common.css',
  30. { src: 'element-ui/lib/theme-chalk/index.css' }
  31. ],
  32. // router: {
  33. // middleware: 'i18n'
  34. // },
  35. router: {
  36. middleware: 'i18n'
  37. },
  38. /*
  39. ** Plugins to load before mounting the App
  40. */
  41. plugins: [
  42. { src: '~plugins/element-ui', ssr: true },
  43. { src: '~plugins/set-DOMPurify.js', ssr: true },
  44. { src: '~plugins/baidu-map', ssr: false },
  45. '~/plugins/axios',
  46. '~/plugins/util',
  47. '~/plugins/i18n.js',
  48. '~/plugins/route.client.js' // only in client side
  49. ],
  50. generate: {
  51. routes: ['/', '/about', '/zh_CN', '/zh_CN/about']
  52. },
  53. /*
  54. ** Nuxt.js dev-modules
  55. */
  56. buildModules: [
  57. ],
  58. /*
  59. ** Nuxt.js modules
  60. */
  61. modules: [
  62. // Doc: https://axios.nuxtjs.org/usage
  63. '@nuxtjs/axios',
  64. '@nuxtjs/proxy'
  65. ],
  66. /*
  67. ** Axios module configuration
  68. ** See https://axios.nuxtjs.org/options
  69. */
  70. axios: {
  71. },
  72. /*
  73. ** Build configuration
  74. */
  75. build: {
  76. vendor: ['element-ui'], // 添加模块,配置只打包一次,减少应用bundle的体积
  77. extractCSS: { allChunks: true },
  78. babel: {
  79. plugins: [
  80. ["component", { "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }]
  81. ]
  82. },
  83. /*
  84. ** You can extend webpack config here
  85. */
  86. extend (config, ctx) {
  87. },
  88. }
  89. }