vue.config.js 1.6 KB

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