The plugin interface changed from v3 to v4. The changelog lists the incompatibilities. Things that are definitely, or likely to need working around are:
"Plugins should use Compiler.hooks.xxx.tap(, fn) now" - used here and here
As far as I have tested from updating the interface on the previous point, there are no further changes needed. However, in #6 it was suggested that the structure of stats.chunks has changed from a flat structure to a nested structure. I haven't been able to reproduce this.
Backwards compatibility for v3
Detecting the presence of Compiler.hooks should be sufficient feature detection to know whether to add the plugin via the v3/v4 interface.
Unless there is any confirmation of the second point above, the internals of webpack used by plugin plugins does not need to change:
compilation.getStats().hasErrors() ✅
compilation.assets[id].existsAt ✅
stats.chunks ⁇ TBC
Tests
Tests have been adjusted so that they run on a matrix of node/webpack versions. Webpack v4 no longer supports Node v4 so that is excluded from the matrix.
Goals and changeset
Webpack v4 compatibility
The plugin interface changed from v3 to v4. The changelog lists the incompatibilities. Things that are definitely, or likely to need working around are:
stats.chunks
has changed from a flat structure to a nested structure. I haven't been able to reproduce this.Backwards compatibility for v3
Detecting the presence of Compiler.hooks should be sufficient feature detection to know whether to add the plugin via the v3/v4 interface. Unless there is any confirmation of the second point above, the internals of webpack used by plugin plugins does not need to change:
compilation.getStats().hasErrors()
✅compilation.assets[id].existsAt
✅stats.chunks
⁇ TBCTests
Tests have been adjusted so that they run on a matrix of node/webpack versions. Webpack v4 no longer supports Node v4 so that is excluded from the matrix.