feat: accept empty string in config.resolve.extensions#12613
Merged
sokra merged 2 commits intowebpack:masterfrom Apr 19, 2021
iguessitsokay:resolve-extensions-minlength
Merged
feat: accept empty string in config.resolve.extensions#12613sokra merged 2 commits intowebpack:masterfrom iguessitsokay:resolve-extensions-minlength
sokra merged 2 commits intowebpack:masterfrom
iguessitsokay:resolve-extensions-minlength
Conversation
Contributor
|
For maintainers only:
|
sokra
requested changes
Feb 8, 2021
Member
sokra
left a comment
There was a problem hiding this comment.
Ok we can do that, but in this case I would like that enforceExtension defaults to true when extensions contains an empty string.
Contributor
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
Contributor
Author
|
Thanks @sokra, that's great. |
- remove minLength from extensions in schema/WebpackOptions - add tests reflecting the change - no conflicts with existing tests - no conflicts with enhanced-resolve
sokra
approved these changes
Apr 19, 2021
Member
|
Thanks |
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.
Current behavior:
There is no way to determine the order of resolve attempts between the original request and appending extensions.
Expected behavior:
Adding an empty string to extensions sets the order of resolve attempt for the original request. This is only beneficial when used together with enforceExtension: true to pass the default intial resolve attempt.
Arguments:
[".js", ""]) saves from unnecessaryfile -> final-fileresolve steps, without giving up the ability to resolve the original request when necessary.What kind of change does this PR introduce?
feature
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
In resolve.extensions: Adding an empty string to extensions (e.g.
[".js", ""]), determines the order of resolve attempt for the original request. By default resolver tries the original request before adding extensions; this initial attempt can be skipped by setting enforceExtension: true.