webpack-deadcode-plugin
webpack-deadcode-plugin copied to clipboard
compilation.getAssets is not a function
webpack : 3.x babel-loader : 6.2.4 react: 15.x cmd : webpack --config xxx.js --watch 执行错误,compilation.getAssets is not a function
你改下他的源码就行了。compilation.getAssets 是 webpack4 才有的 api。用 compilation.assets 试试
seeing same with "webpack": "^4.12.1"
98% after emitting WebpackDeadcodePluginC:\git\myApp\node_modules\webpack-deadcode-plugin\src\detect.js:164
compilation.getAssets().forEach(asset => {
^
TypeError: compilation.getAssets is not a function
at getWebpackAssets (C:\git\myApp\node_modules\webpack-deadcode-plugin\src\detect.js:164:14)
at detectDeadCode (C:\git\myApp\node_modules\webpack-deadcode-plugin\src\detect.js:9:17)
at WebpackDeadcodePlugin.handleAfterEmit (C:\git\myApp\node_modules\webpack-deadcode-plugin\src\index.js:32:3)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\git\myApp\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:14:1)
at AsyncSeriesHook.lazyCompileHook (C:\git\myApp\node_modules\webpack\node_modules\tapable\lib\Hook.js:154:20)
at C:\git\myApp\node_modules\webpack\lib\Compiler.js:432:27
at C:\git\myApp\node_modules\neo-async\async.js:2813:7
at done (C:\git\myApp\node_modules\neo-async\async.js:3521:9)
at MemoryFileSystem.writeFile (C:\git\myApp\node_modules\memory-fs\lib\MemoryFileSystem.js:328:9)
at writeOut (C:\git\myApp\node_modules\webpack\lib\Compiler.js:415:30)
at Immediate.<anonymous> (C:\git\myApp\node_modules\memory-fs\lib\MemoryFileSystem.js:288:4)
at processImmediate (internal/timers.js:464:21)