vue.config.js 1.7 KB

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