-
-
Notifications
You must be signed in to change notification settings - Fork 284
Support for manifest plugin and other modules utilizing moduleAsset hook #309
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure it is right solution, because we interpreted files as module assets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works for blizzard websites. And I don't see why this wouldn't work as this is how manifest plugin knows if dist path names have changed. I'll figure out test cases if I have time, otherwise it is a working solution.
https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L86-L87
https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L214-L216
https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L42-L49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skliffmueller Here (https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L59) we need implement hook
compilation.applyPluginsAsync('webpack-manifest-plugin-before-emit', callback);And use this hook in this plugin.
We should not pass this as
modulebecause it can break analyze tools.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And to avoid problems with other plugins we need implement new hooks in
webpack, examplemanifestwhich call afteremit. It is also easy implement and feel free to ping me inwebpackrepoThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that will help the situation, as copy-webpack-plugin doesn't need to know what the manifest looks like, webpack-manifest-plugin needs to know what copy-webpack-plugin has modified. In webpack-manifest-plugin stats.assets from the complication object is the only point where the copy-webpack-plugin assets exist. and moduleAssets is the only object map to reference the hash file names to the original path. Otherwise it defaults to the file name.
https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L88-L114
So either copy-webpack-plugin is not implemented correctly, webpack complication assets is not implemented correctly (needs to include ability to set asset name and path), or webpack-manifest-plugin isn't implemented correctly and needs to listen to an additional hook to build against the object mapping between hash file names and original file names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because adding this as
modulecan break analyze tools, also it is not module.Manifest plugin have 2 problem:
emithooks (it is not safe because other plugins also add assets on this hook and some assets may disappear). As i said above we need new hook inwebpackfor this. You can send a PR inwebpack, I will support you, should be easy.These tasks are in my todo lists, but at the moment there are more priorities, so you can start doing this and I will be happy to help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I might not have clearly understood you at first. But I get it, we are on the same page. I will look into doing this over the weekend when work isn't chasing after me.