nuxt.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const pkg = require("./package");
  2. module.exports = {
  3. mode: "spa",
  4. env: {
  5. BASE_URL: process.env.BASE_URL,
  6. NODE_ENV: process.env.NODE_ENV
  7. },
  8. server: {
  9. host: "0.0.0.0",
  10. port: 3001
  11. },
  12. /**
  13. * 打包文件
  14. */
  15. build: {
  16. vendor: ["axios", "element-ui"]
  17. },
  18. /*
  19. ** Headers of the page
  20. */
  21. head: {
  22. title: "程序员客栈后台",
  23. meta: [
  24. { charset: "utf-8" },
  25. { name: "viewport", content: "width=device-width, initial-scale=1" },
  26. { hid: "description", name: "description", content: "程序员客栈后台" }
  27. ],
  28. link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
  29. },
  30. /*
  31. ** Customize the progress-bar color
  32. */
  33. loading: { color: "#fff" },
  34. /*
  35. ** Global CSS
  36. */
  37. css: [
  38. "element-ui/lib/theme-chalk/index.css",
  39. "@/assets/css/common.css",
  40. "./styles/index.scss"
  41. ],
  42. /*
  43. ** Plugins to load before mounting the App
  44. */
  45. plugins: ["@/plugins/element-ui", "@/plugins/http", "@/plugins/quill"],
  46. /*
  47. ** Nuxt.js modules
  48. */
  49. modules: [
  50. // Doc: https://github.com/nuxt-community/axios-module#usage
  51. "@nuxtjs/axios",
  52. "@nuxtjs/proxy"
  53. ],
  54. /*
  55. ** Axios module configuration
  56. */
  57. axios: {
  58. // See https://github.com/nuxt-community/axios-module#options
  59. },
  60. /**
  61. * Proxy
  62. */
  63. proxy: [
  64. ["/api", { target: "https://dev.test.proginn.com/", changeOrigin: true }]
  65. ],
  66. /*
  67. ** Build configuration
  68. */
  69. build: {
  70. /*
  71. ** You can extend webpack config here
  72. */
  73. extractCSS: { allChunks: true }, // css 独立打包 link 的形式加载
  74. splitChunks: {
  75. chunks: "all",
  76. automaticNameDelimiter: "."
  77. },
  78. optimization: {
  79. splitChunks: true
  80. },
  81. extend(config, ctx) {}
  82. },
  83. router: {
  84. middleware: "initialize"
  85. }
  86. };