Skip to content
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

Supports webpack5 and mini-css-extract-plugin #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sunft1996
Copy link

Supports webpack5 and mini-css-extract-plugin, with the following 3 changes:

  1. Cancel proxy for the parameters of the tap/tapAsync/tapPromise function, as mini-css-extract-plugin will use the compilation parameter passed to the tap function(code here), but it will get the proxy object instead of itself, which causes some bugs.
  2. Cancel the proxy for all methods of the compiler for a similar reason as the first one, as some plugins require the original method, such as mini-css-extract-plugin, which uses compile.webpack as the cache. code here
  3. Replace webpack5 incompatible normal-module-loader hook, although it can still be used now, it will be removed in the future.

I ran through all the test cases and it seems to be okay. I hope it helps :)

@sunft1996 sunft1996 force-pushed the webpack5 branch 2 times, most recently from f543839 to 1a804dd Compare July 20, 2023 07:58
@brollin
Copy link

brollin commented Oct 2, 2023

Worked for me - thanks! In case this repo is still maintained, this should definitely be merged. @stephencookdev

@sharikovvladislav
Copy link

Why don't you merge it? @stephencookdev

@tanchu
Copy link

tanchu commented Oct 16, 2023

@stephencookdev merge please

@sharikovvladislav
Copy link

sharikovvladislav commented Oct 16, 2023

For those who can't run the plugin on the 5th webpack:

  1. Clone the @sunft1996 repo https://github.com/sunft1996/speed-measure-webpack-plugin-source-read/tree/webpack5
  2. Go the repo dir
  3. Checkout the needed branch: it is the webpack5 branch
  4. npm ci in the directory to get the dependencies (install nodejs of needed version if you don't have one or fix the .nvmrc)
  5. Go to your project directory
  6. Run the npm i --save-dev <path_to>/speed-measure-webpack-plugin-source-read command

For example, in my case, it was the npm i --save-dev ../speed-measure-webpack-plugin-source-read because it was an adjacent directory.

After that you will be able to run the plugin even with the webpack@5

FYI @tanchu

@sunft1996 Great effort, man. You helped a lot.

@tanchu
Copy link

tanchu commented Oct 17, 2023

@sharikovvladislav Thanx!

@Rush
Copy link

Rush commented Nov 24, 2023

@sunft1996 can you use npx publish-to-git to publish a version to your repo? Then we will be able to install as such https://www.npmjs.com/package/publish-to-git#consumption-of-private-git-npm-packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants