GeezerVison is showing github.com — fix(config): normalize file URLs for options taking absolute paths by Pcmhacker-piro · Pull Request #22059 · webpack/webpack
Conversation
Pcmhacker-piro
commented
Sep 11, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
In #22012 / commit 3a69d29, webpack added support for file:// URLs wherever options take an absolute path, converting them during options normalization in lib/config/normalization.js for options like context, output.path, snapshot.managedPaths, cacheDirectory, etc.
However, several other options that take "absolutePath": true per schemas/WebpackOptions.json were omitted from normalization:
module.noParse: NormalModule.applyNoParseRule compares content.startsWith(rule). Since content is a filesystem path and rule remained a file:// URL, they never matched, causing modules to be parsed unexpectedly.
resolve.restrictions & resolveLoader.restrictions: passed directly to enhanced-resolve as file:// URLs, causing resolution failures for allowed paths.
stats.context: passed to RequestShortener / contextify without normalization, causing broken relative paths.
dotenv.dir & experiments.buildHttp: passed to path utilities expecting filesystem paths.
This PR normalizes file URLs to filesystem paths for these options in lib/config/normalization.js.
Fixes #22057.
What kind of change does this PR introduce?
bugfix
Did you add tests for your changes?
Yes:
- Unit tests in
test/Normalization.unittest.js covering normalization of module.noParse, resolve.restrictions, resolveLoader.restrictions, stats.context, dotenv.dir, and experiments.buildHttp.
- Integration config test in
test/configCases/no-parse/file-url/ (gated with supportsFileUrlPaths() matching test/configCases/rule-set/file-url-condition/).
Does this PR introduce a breaking change?
No. Non-file-URL values, RegExps, and functions pass through unchanged.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Yes
Summary by CodeRabbit
-
New Features
- File URLs are now normalized to filesystem paths across more configuration options, including module parsing, resolution restrictions, statistics context, dotenv settings, and HTTP build settings.
noParse supports file URLs, allowing selected modules to remain unparsed while other modules continue to be processed normally.
-
Bug Fixes
- Improved consistency when configuration values use file URLs alongside regular paths and expressions.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit 3a69d29 updated the schema validator to accept file URLs
wherever an option takes an absolute path, and normalized file URLs
for options like context, output.path, cacheDirectory, etc.
However, several other options accepting absolute paths per schema were
omitted from normalization in lib/config/normalization.js:
- module.noParse: NormalModule checks content.startsWith(rule) which
silently failed to match filesystem paths against file URLs.
- resolve.restrictions and resolveLoader.restrictions: passed to
enhanced-resolve as file URLs, causing resolution errors for allowed paths.
- stats.context: passed to RequestShortener / contextify, causing broken
relative paths.
- dotenv.dir and experiments.buildHttp: passed to path join utilities
expecting filesystem paths.
Now all of these options convert file URLs to filesystem paths during
options normalization.
Closes webpack#22057.
|
👋 Hi there! This PR was automatically flagged and closed by our quality checks.
If you believe this was a mistake, please review our contributing guidelines
and leave a comment explaining why this is a mistake.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Sep 11, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
 
Caution
Review failed
The pull request is closed.
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: ac567add-af7e-405b-b53f-8292e9fb1dad
📥 Commits
Reviewing files that changed from the base of the PR and between 3a69d29 and a3736e5.
📒 Files selected for processing (10)
.changeset/007-file-url-normalization.md
lib/config/normalization.js
test/Normalization.unittest.js
test/configCases/no-parse/file-url/dep.js
test/configCases/no-parse/file-url/index.js
test/configCases/no-parse/file-url/not-parsed-a.js
test/configCases/no-parse/file-url/not-parsed-b.js
test/configCases/no-parse/file-url/parsed.js
test/configCases/no-parse/file-url/test.filter.js
test/configCases/no-parse/file-url/webpack.config.js
📝 Walkthrough
Walkthrough
Webpack now converts file URLs to filesystem paths for additional configuration options. Unit tests cover conversion and preservation of existing values. A new configuration case verifies file URL support for module.noParse.
Changes
File URL normalization
| Layer / File(s) |
Summary |
Configuration normalization lib/config/normalization.js, .changeset/007-file-url-normalization.md |
Normalizes file URLs in module.noParse, dotenv.dir, HTTP build locations, resolver restrictions, and stats.context. |
Normalization tests test/Normalization.unittest.js |
Verifies file URL conversion and preserves plain paths and regular expressions. |
noParse file URL case test/configCases/no-parse/file-url/* |
Verifies that modules matched by file URLs are not parsed and that other modules remain parsed. |
Change: Bug fix · Severity of issue fixed: Medium
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
area: config
Options, defaults, validation (lib/config, schemas/)
Milestone
No milestone
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.
|