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

Use stage: Infinity for webpack@4 #141

Closed
alexander-akait opened this issue Apr 11, 2018 · 3 comments · Fixed by #142
Closed

Use stage: Infinity for webpack@4 #141

alexander-akait opened this issue Apr 11, 2018 · 3 comments · Fixed by #142

Comments

@alexander-akait
Copy link
Contributor

A lot of plugins use emit event to add own assets, manifest in 99% required only when all files were added to compilation.assets. Tapable have stage option for avoid this situation. https://github.com/webpack/tapable/blob/6b91ca9e94cf032420a57a2d0b82b627462b5c1c/lib/Hook.js#L130.

Just change from:

compiler.hooks.emit.tap('ManifestPlugin', emit);

To:

compiler.hooks.emit.tap({ name: 'ManifestPlugin', stage: Infinity}, emit);

It is allow to avoid situation when other plugin use emit event and add new assets. I agree what using hook is better, but sometimes it is impossible, because you don't have access to plugin repo.

@mastilver
Copy link
Contributor

mastilver commented Apr 11, 2018

Nice! This is awesome!! :)

While you are here, I don't think it's possible but is there a way to run the webpack writes sequentially? (https://github.com/webpack/webpack/blob/0b1e9d8e09aa3f346707776f08f3307b06758d8d/lib/Compiler.js#L282)

We used to use a queue that would allow one emit event to be proceed at a time
Now rather than emitting multiple time, it just emit at the end. I think it's good but it could bring some edge cases I'm not aware yet

This was the original issue: #21
And the recent implementation change: #134

@alexander-akait
Copy link
Contributor Author

@mastilver i think we can implement by default stage: Infinity, if somebody will have problem we can add option for this (example pluginStage or better name). But i think nobody have problem with stage, if somebody have extra assets they can use filter to avoid unnecessary data in manifest. If somebody don't have assets they can use seed. I can do PR, if you agree 👍

@mastilver
Copy link
Contributor

I think we can implement by default stage: Infinity

yep totally

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 a pull request may close this issue.

2 participants