shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.43k stars 185 forks source link

feat: Added ability to adjust plugin processAssets hook stage (#262) #263

Closed tomlagier closed 2 years ago

tomlagier commented 3 years ago

This PR contains:

Are tests included?

Breaking Changes?

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers: #262

Description

This PR adds the ability to modify the processAssets stage that the WebpackManifestPlugin runs under. Currently, it is hard-coded to Infinity, which means that it will always run last in the processAssets stack. If we want to do some async behavior based on the output of the manifest, we need to schedule a hook later in the processAssets series.

This allows us to manually modify the stage the hook runs at by passing a processAssetsStage option. We can set it to, e.g. webpack.Compiler.PROCESS_ASSETS_STAGE_ANALYSE and then add our own plugin at PROCESS_ASSETS_STAGE_REPORT.

shellscape commented 3 years ago

@tomlagier thanks for opening this PR. I'm good with the concept with one caveat: I'd like to rename the option to assetHookStage. Aside from that, please update from upstream/master where we've fixed the dependency issues, and please resolve any conflicts. Once that's done, we'll merge and ship it.

tomlagier commented 3 years ago

Sounds good, will get those updates in today.

tomlagier commented 3 years ago

Updated the PR, but I was having some lint & TS errors in untouched files.

shellscape commented 2 years ago

That's strange. Just checked master and it's looking OK.

shellscape commented 2 years ago

This https://github.com/shellscape/webpack-manifest-plugin/runs/4777081149?check_suite_focus=true#step:11:92 is why CI was failing. I'll clean this up and push to your branch so this can be merged.