jhthorsen / mojolicious-plugin-webpack

Integrate your mojo app with webpack
13 stars 7 forks source link

migrate to webpack 5 #11

Closed dmanto closed 3 years ago

dmanto commented 3 years ago

These changes will allow to work with webpack 5+, which I think should be the new default.

webpack 5 introduced a lot of breaking changes, I just fixed the minimum to pass current test, specially t/example-build-assets.t test.

They are big changes though, and I am not very sure of the full implicances (I am not an expert on webpack, but I have been using it since several months). I have a version running in my computer with these changes and running webpack 5, and seem to work fine, but other than that I can't tell.

There is also a specific guide on webpack site, that can address further needed changes, but I didn't need to follow it because the changes introduced by this PR were enough in my case.

Some breaking changes considered:

Quick testing

It can be dificult to migrate from a installed webpack 4 to 5 in the middle of a project, so in my repo there is a branch 'test-container' that can be used as a smoke test if you change anything. Has a minimal Dockerfile to have a perl 5.32 container with npm installed.

Just checkout to that branch and run:

docker build -t test-cont . && docker run -e TEST_ALL=1 -t test-cont prove -l t/example-build-assets.t
jhthorsen commented 3 years ago

Looks great!

The description is excellent and the changes are to the point. Thank you 👍

The plugin will not change an existing package.json, so projects that use webpack 4 will just continue to work.