vue.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const { defineConfig } = require('@vue/cli-service')
  2. module.exports = defineConfig({
  3. transpileDependencies: true,
  4. lintOnSave:false,
  5. publicPath: "./", // 公共路径(必须有的)
  6. outputDir: "bigData", // 输出文件目录
  7. assetsDir: "static", //静态资源文件名称
  8. productionSourceMap: false, //去除打包后js的map文件
  9. devServer: { //启动项目在8080端口自动打开
  10. host:"127.0.0.1",
  11. open: true,
  12. port: 30000,
  13. //proxy: null,
  14. proxy: process.env.VUE_APP_ENV === 'production' ? 'https://www.aaa.com/' : 'https://gateway.bbb.com/'
  15. },
  16. chainWebpack(config) {
  17. config
  18. .when(process.env.VUE_APP_ENV !== 'www.dlc.com',
  19. config => {
  20. config
  21. .plugin('ScriptExtHtmlWebpackPlugin')
  22. .after('html')
  23. .use('script-ext-html-webpack-plugin', [{
  24. // `runtime` must same as runtimeChunk name. default is `runtime`
  25. inline: /runtime\..*\.js$/
  26. }])
  27. .end()
  28. config
  29. .optimization.splitChunks({
  30. chunks: 'all',
  31. minSize: 50000, //构建出来的chunk大于30000才会被分割
  32. maxSize: 100000, //会尝试根据这个大小进行代码分割
  33. })
  34. }
  35. )
  36. },
  37. })