stephencookdev / speed-measure-webpack-plugin

⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds
MIT License
2.42k stars 79 forks source link

wrap hooks object so that plugins can add custom hooks #169

Open davidparkagoda opened 3 years ago

davidparkagoda commented 3 years ago

this might fix https://github.com/stephencookdev/speed-measure-webpack-plugin/issues/44

I saw issues with incremental builds especially with HardSourceWebpackPlugin. This changes fixes it for me.

Debugging HardSourceWebpackPlugin, it looks like they are modifying the hooks objects to add more hooks https://github.com/mzgoddard/hard-source-webpack-plugin/blob/5122a1c3c3660d94798e73e73b6e36d0fc1d784d/lib/SystemArchetype.js#L14 https://github.com/mzgoddard/hard-source-webpack-plugin/blob/master/lib/util/plugin-compat.js#L59

These modified hooks are okay in the first run, but speed-measure-plugin does not modify the actual hooks when these registrations happen. This makes the subsequent newly created hooks object fail during the next incremental build.