【发布时间】:2019-03-18 01:42:35
【问题描述】:
我在摇树时遇到问题。似乎它对我的项目不太有效。有没有办法查看我的 webpacked 文件中实际使用的依赖项列表?
Webpack 配置:
entry: sourceEntryFile,
mode: 'production', // for webpack 4
target: 'node',
output: {
filename: '[name].js',
path: outputPathFolder,
libraryTarget: 'commonjs',
},
resolve: {
extensions: ['.js', '.json'],
modules: ['node_modules']
},
node: {
__dirname: false,
},
externals: {
'aws-sdk': 'aws-sdk'
},
plugins: (() => {
const plugins = [
new webpack.DefinePlugin({
'global.GENTLY': false
})
];
// plugins.push(new WebpackBundleAnalyzer.BundleAnalyzerPlugin());
return plugins;
})()
【问题讨论】:
-
通常使用 WebpackBundleAnalyzer。你有什么问题?
-
@estus 我觉得删除死代码没有应有的效率。 WebpackBundleAnalyzer 只显示使用的内容,对吗?
标签: node.js webpack tree-shaking