DependencyExtractionWebpackPlugin: Add true shorthand for requestToExternalModule#57593
Merged
Merged
Conversation
|
Size Change: 0 B Total Size: 1.69 MB ℹ️ View Unchanged
|
jsnajdr
reviewed
Jan 5, 2024
| requestToExternalModule( request ) { | ||
| if ( request.startsWith( '@wordpress/' ) ) { | ||
| return request; | ||
| return true; |
Member
There was a problem hiding this comment.
There are 10 other fixtures where the implementation could also be shortened to:
return request.startsWith( '@wordpress/' );
Member
Author
There was a problem hiding this comment.
Do you think we should update all of them? The other style is also valid and it seems fine to test the different forms.
Member
There was a problem hiding this comment.
It's a minor nit of course, but I'd personally update all of them. There's the module-renames test that tests the rename specifically, and covers the string return value.
Member
Author
There was a problem hiding this comment.
That's fair, I went ahead and updated them all.
9ad848b to
a65f37d
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
The most common usage of the
requestToExternalModuleis to return the same requested module ID that was passed in. We add a simple of returningtrueto support this behavior without returning the original request.Why?
This makes the most common usage simpler. Instead of returning the string that was passed in,
truecan be returned.See #57199 (comment)
Testing Instructions
The default
requestToExternalModuleand some tests have been updated to use thetrueform. You can see that the none of the snapshots in tests require changes because this behavior works correctly.