whychw
2021-04-17 308336582cec4a2ed610eec5b9799f2497a4e4af
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  publicPath: process.env.NODE_ENV === 'production'
    ? './'
    : '/'
  ,devServer: {
    publicPath: '/',
    open: true
  },
  // 打正式包时不生成map文件 提升打包速度
  productionSourceMap: false,
  //webpack配置
  configureWebpack: config => {
    //调试JS
    config.devtool = "source-map";
    config['performance'] = {
      hints:'warning',
      //入口起点的最大体积
      maxEntrypointSize: 50000000,
      //生成文件的最大体积
      maxAssetSize: 30000000,
      //只给出 js 文件的性能提示
      assetFilter: function(assetFilename) {
        return assetFilename.endsWith('.js');
      }
    }
    /*config['plugins'] = [
      new HtmlWebpackPlugin({
        // filename: 'index.html',
        // template: 'index.html'
        // inject: true
      })
    ]*/
 
  },
  chainWebpack: config => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title= '综合电力监控管理系统'
        return args
      })
  },
  css: {
    //查看CSS属于哪个css文件
    sourceMap: true
  }
}