-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use same hook for both webpack 4 and 5 #246
Conversation
The CI tests are not running the webpack v5 testsuite but when running locally all 49 tests pass. |
This option is used as compat option for older plugins.
PR now contains the new Circleci fails on the security audit btw. |
@Levdbas please merge from upstream/master for the audit fix. We're going to need a test specifically for using webpack v5 with the plugin and |
Upstream is merged. Any idea how to make this test work? Include a plugin from which we know only emits on the legacy hook and lock the version? I have no experience with AVA yet so I will see what I can do. |
Ava is very similar to Jest, the learning curve is small. That sounds like a good test plan to me. |
This commit adds a new unit test in the options section that tests the new useLegacyEmit option. The test runs DependencyExtractionWebpackPlugin that is locked on version 3.1.0. This version emits the main.asset.json on the emit hook. If useLegacyEmit is set to false the test fails on the webpack v5 tests.
Well that was fairly straightforward. Let me know if everything is in order this way. |
Hi @shellscape , did you had the chance to take a look at the test? |
Hi @shellscape , any word if and when you can merge this and release this in a new version? |
Yeah this PR is going to be part of the last release of support for webpack v4 and Node v10. Stand by. |
I'd like to chime in and say that I'm troubled by the hook discrepancy as well. I wrote a localization plugin, which duplicates assets and localizes them (essentially just string replacement) after the optimization/minification stage (because we don't want minification to repeat for the duplicated assets). For WP4, the localization runs in the For WP5, the localization runs in the The reason why I need to hook into That said, I might recommend not using the Edit:
@shellscape Curious what reasoning they gave you? |
@privatenumber I honestly can't remember now what the feedback was, it's just been too long. One of those "I remember why, but not what" situations. That said, I'm all for using |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers: #245
Description
emitHook is now running on compiler.hooks.emit.tap(hookOptions, emit); for webpack 4/5. This fixes #245
As said in the issue, I have little experience with webpack plugins, but the tests seems to work for both webpack 4 and 5.