The default site generated by bridgetown new currently runs on Webpack 4. Webpack 5 has been out for a couple of months now and I think we should support it by default.
Reference-level explanation
It should be a straightforward upgrade "in theory". The only blocker I encountered was the ManifestPlugin doesn't seem to quite work with Webpack 5. Even when using v3 of the plugin which is supposed to support Webpack 5; I ran into a weird issue where it prefixed auto to every path in the manifest for some reason. Not sure if this was due to Webpack or the plugin.
I got around this issue in my projects by using the AssetsPlugin instead. I discovered it while reading this Twitter thread from Gary Bernhardt. The format of the JSON output from this plugin is a bit different though so I had to monkey patch some Bridgetown code to get it working.
How and when should we proceed with this? Obviously the preferred option would be to get the ManifestPlugin working if possible, but should we consider switching to the AssetsPlugin at all?
I remember @andrewmcodes saying he was also looking into this. I thought I'd create this issue so we can discuss how and when to proceed with this!
Thanks for bringing this up @ayushn21. I'm not familiar with what has changed from v4 to v5, but I agree it will soon be expected that we have a proper upgrade strategy in place.
Summary
The default site generated by
bridgetown new
currently runs on Webpack 4. Webpack 5 has been out for a couple of months now and I think we should support it by default.Reference-level explanation
It should be a straightforward upgrade "in theory". The only blocker I encountered was the
ManifestPlugin
doesn't seem to quite work with Webpack 5. Even when using v3 of the plugin which is supposed to support Webpack 5; I ran into a weird issue where it prefixedauto
to every path in the manifest for some reason. Not sure if this was due to Webpack or the plugin.I got around this issue in my projects by using the
AssetsPlugin
instead. I discovered it while reading this Twitter thread from Gary Bernhardt. The format of the JSON output from this plugin is a bit different though so I had to monkey patch some Bridgetown code to get it working.You can see my setup here: https://github.com/ayushn21/static-site-template. The monkey patch is in
plugins/monkey_patches
.Unresolved Questions
How and when should we proceed with this? Obviously the preferred option would be to get the
ManifestPlugin
working if possible, but should we consider switching to theAssetsPlugin
at all?I remember @andrewmcodes saying he was also looking into this. I thought I'd create this issue so we can discuss how and when to proceed with this!