Making this package compatible with Webpack v5#194
Open
rising-entropy wants to merge 4 commits intostephencookdev:masterfrom
Open
Making this package compatible with Webpack v5#194rising-entropy wants to merge 4 commits intostephencookdev:masterfrom
rising-entropy wants to merge 4 commits intostephencookdev:masterfrom
Conversation
DzmVasileusky
suggested changes
Jun 1, 2023
|
|
||
| const wrapped = Object.keys(hooks).reduce((acc, method) => { | ||
| acc[method] = genProxy(method); | ||
| if (method != "normalModuleLoader") |
There was a problem hiding this comment.
it is too hardcoded, now it is arguing with additionalChunkAssets
so I changed it to be like
if (hooks[method])
acc[method] = genProxy(method);
|
It would be super helpful to get this merged for me today :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves the deprecation warning with regards to the normal-module-loader, invoking the loader from it's new location.
Also, adding an option of passing an array of strings of names of all the plugins that it should refrain from tracking.
A little background about this:
So the basic way of SMP plugin to measure plugin-timings is that it wraps each plugin into a Wrapper Plugin which has hooks to measure time before and after completion.
Since plugins like the MiniCSSExtractPlugin throw can exception when the invoker is not from the main MiniCSSExtractPlugin class, we need to exclude it from wrapping within the plugin.
Now here's how you can do this with this PR.
Alongside just sending the parameter of
configinsmp.wrap(config), you now also share the names of the plugins that usually fail the build or start of the dev server (Example: ReactRefreshPlugin while we are using SMP plugin in react dev server).So the syntax would be:
smp.wrap(config, ['MiniCSSExtractPlugin', 'ReactRefreshPlugin'])And voila!
You can now use the package in your code without worrying that it would fail the builds or blow the code at runtime.
I don't know if and when this would be integrated in the package, so I'll also be making a separate package of this soon.
Hope it helps :)