|
@@ -4,8 +4,6 @@ const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV);
|
|
const resolve = (dir) => path.join(__dirname, dir);
|
|
const resolve = (dir) => path.join(__dirname, dir);
|
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); // 去掉 console.log
|
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); // 去掉 console.log
|
|
//打包分析
|
|
//打包分析
|
|
-const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
|
|
|
|
- .BundleAnalyzerPlugin;
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
publicPath: "./", // 默认'/',部署应用包时的基本 URL
|
|
publicPath: "./", // 默认'/',部署应用包时的基本 URL
|
|
indexPath: 'index.html', // 相对于打包路径index.html的路径
|
|
indexPath: 'index.html', // 相对于打包路径index.html的路径
|
|
@@ -87,15 +85,5 @@ module.exports = {
|
|
open: true, // 是否打开浏览器
|
|
open: true, // 是否打开浏览器
|
|
},
|
|
},
|
|
//打包分析
|
|
//打包分析
|
|
- chainWebpack: config => {
|
|
|
|
- // 打包分析
|
|
|
|
- if (IS_PROD) {
|
|
|
|
- config.plugin("webpack-report").use(BundleAnalyzerPlugin, [
|
|
|
|
- {
|
|
|
|
- analyzerMode: "static"
|
|
|
|
- }
|
|
|
|
- ]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|