vue.config.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. const { defineConfig } = require("@vue/cli-service")
  2. module.exports = defineConfig({
  3. //设置为空打包后不分更目录还是多级目录
  4. publicPath: "",
  5. outputDir: "dist",
  6. //build编译后存放静态文件的目录
  7. //assetsDir: "static",
  8. // build编译后不生成资源MAP文件
  9. productionSourceMap: false,
  10. //开发服务,build后的生产模式还需nginx代理
  11. devServer: {
  12. allowedHosts: "all",
  13. open: false, //运行后自动打开浏览器
  14. port: process.env.VUE_APP_PORT, //挂载端口
  15. client: { overlay: false },
  16. proxy: {
  17. "/zcxt": {
  18. target: process.env.VUE_APP_API_BASEURL,
  19. changeOrigin: true,
  20. ws: false,
  21. pathRewrite: {
  22. "^/zcxt": ""
  23. }
  24. }
  25. }
  26. },
  27. chainWebpack: config => {
  28. // 移除 prefetch 插件
  29. config.plugins.delete("preload");
  30. config.plugins.delete("prefetch");
  31. config.resolve.alias.set("vue-i18n", "vue-i18n/dist/vue-i18n.cjs.js");
  32. },
  33. configureWebpack: {
  34. //性能提示
  35. performance: {
  36. hints: false
  37. },
  38. optimization: {
  39. splitChunks: {
  40. chunks: "all",
  41. automaticNameDelimiter: "~",
  42. name: "scuiChunks",
  43. cacheGroups: {
  44. //第三方库抽离
  45. vendor: {
  46. name: "modules",
  47. test: /[\\/]node_modules[\\/]/,
  48. priority: -10
  49. },
  50. elicons: {
  51. name: "elicons",
  52. test: /[\\/]node_modules[\\/]@element-plus[\\/]icons-vue[\\/]/
  53. },
  54. tinymce: {
  55. name: "tinymce",
  56. test: /[\\/]node_modules[\\/]tinymce[\\/]/
  57. },
  58. echarts: {
  59. name: "echarts",
  60. test: /[\\/]node_modules[\\/]echarts[\\/]/
  61. },
  62. xgplayer: {
  63. name: "xgplayer",
  64. test: /[\\/]node_modules[\\/]xgplayer.*[\\/]/
  65. },
  66. codemirror: {
  67. name: "codemirror",
  68. test: /[\\/]node_modules[\\/]codemirror[\\/]/
  69. }
  70. }
  71. }
  72. }
  73. }
  74. })