vue.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: 8888,
  13. //proxy: null,
  14. proxy: process.env.VUE_APP_ENV === 'production' ? 'https://www.aaa.com/' : 'https://gateway.bbb.com/'
  15. },
  16. //去掉console
  17. configureWebpack: (config) => {
  18. // 判断为生产模式下,因为开发模式我们是想保存console的
  19. if (process.env.NODE_ENV === "production") {
  20. config.optimization.minimizer.map((arg) => {
  21. const option = arg.options.terserOptions.compress;
  22. option.drop_console = true; // 打开开关
  23. return arg;
  24. });
  25. }
  26. },
  27. configureWebpack: {
  28. // 关闭 webpack 的性能提示
  29. // performance: {
  30. // hints:false
  31. // }
  32. // //或者
  33. // 警告 webpack 的性能提示
  34. performance: {
  35. hints: 'warning',
  36. // 入口起点的最大体积
  37. maxEntrypointSize: 50000000,
  38. // 生成文件的最大体积
  39. maxAssetSize: 30000000,
  40. // 只给出 js 文件的性能提示
  41. assetFilter: function (assetFilename) {
  42. return assetFilename.endsWith('.js')
  43. }
  44. }
  45. }
  46. })