-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Dependency Extraction Webpack Plugin: Add Module support #57199
Merged
Merged
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
c238c47
Changelog placeholder
sirreal 171c235
Implement Module API output
sirreal 8397d1d
Update snapshots
sirreal dce6f57
Bundle interactivity
sirreal 86dfb76
Update snaps
sirreal afaeceb
Update README about module handling
sirreal 7fc14de
Add type => module to module asset files
sirreal 72a7dc8
Remove commented line
sirreal 91dcd12
Fix dynamic test
sirreal c940791
Check for matching name
sirreal e0f8cce
Update CHANGELOG entry
sirreal 10adc23
Fix markdown link syntax
sirreal f456a83
Missing period
sirreal 9d39c86
Revert addition of @wordpress/interactivity to bundled scripts
sirreal 402f6a1
Update snapshots
sirreal 8cdbfd9
Apply README suggestions, add experimental warning
sirreal 53822c6
Fix README modules PHP example
sirreal 1b4800c
Add name to webpack config for easier test debugging
sirreal 4be92b9
Search for a static path to root to test for dynamic
sirreal c626a95
Update snapshots
sirreal a857876
Add cyclic static dep test
sirreal 0b09434
Add cyclic dynamic test
sirreal 75e1443
Add test for renamed modules, fix renamed module bug
sirreal 5eac686
Move ExternalsPlugin instantiation to apply method
sirreal c1098ae
This is supposed to say "assets"
sirreal 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 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
This file contains 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
2 changes: 0 additions & 2 deletions
2
packages/dependency-extraction-webpack-plugin/lib/.eslintrc.json
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
It's more precise to say not that the plugin "overlaps" with
externals
, but that it actually uses theexternals
plugin internally! It creates a configuration for it and passes it to theexternals
plugin to do the actual work.A conflict may arise when you create another instance of the externals plugin in your config, and they both want to process the same module. Then only one can win.
The other, fairly independent functionality of DEWP is finding all the external imports in the bundle and recording them in the
.asset.php
file.The way how both functionalities are mixed together can be confusing for users who are trying to understand what DEWP does. We discussed that once in 2022 with @anomiex but never took any real action to fix it.
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.
This part is copied from the "behavior with scripts" section. There's certainly nuance here, but
externals
in this case refers toexternals
as a configuration option (which I believe uses anExternalPlugin
under the hood, but that's not apparent via webpack config).. The goal is to make it clear that you really shouldn't be adding your own externals declarations for WordPress script/module dependencies.If you have concrete suggestions for how to improve this (and the text in the other section) I'm happy to make changes.
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.
I think I'll do my own PR with a docs update, especially now when this one is merged 👍