wcer
wcer copied to clipboard
support webpack v4
In webpack 4, compiler.fileDependencies is an instance of SortableSet, which inherit from Set. So, when I use this plugin in webpack 4, I got a 'TypeError: comp.fileDependencies.push is not a function'.
I fixed it by determining fileDependencies's type, if it is a SortableSet, use .add to add manifestPath, otherwise keep using .push.
BTW, fileDependencies definition in webpack 4: https://github.com/webpack/webpack/blob/master/lib/Compilation.js#L2142 In webpack 3.12: https://github.com/webpack/webpack/blob/v3.12.0/lib/Compilation.js#L1249