npm i -D webpack-bundle-analyzer core-js babel-loader
webpack.config.js
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; module.exports = {entry: './src/index.js',output: {filename: 'main.js',},// mode: 'production', // 或者 'production'module: {rules: [{test: /\.js$/i,exclude: /node_modules/,use: [{ loader: 'babel-loader', // 需要并行处理的loader // ... 其他babel-loader配置 }, ]}]},plugins: [new BundleAnalyzerPlugin({})]
}
src/index.js
import 'core-js/stable'let a = 1
a+=1
执行完打包后会立即打包在线依赖图