feat: allow file:// protocol prefix in absolute paths - #222
Merged
alexander-akait merged 4 commits intoSep 8, 2026
Conversation
Paths coming from `import.meta.resolve()` are `file://` URLs, so the `absolutePath` keyword accepts an optional `file://` prefix now. Fixes #209 Recreated from #210, rebased on `main`. Co-Authored-By: Sage Abdullah <laymonage@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Walks webpack's own schema for every option reachable from the root that uses `absolutePath: true` - 34 of them, from `output.path` and `context` to the `module.rules` conditions and the `snapshot` path lists - and checks a `file://` URL validates for each, so the support is verified against the real consumer rather than the fixture schema alone. The options that require a relative path are covered too: the prefix must not make one of them accept an absolute path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #222 +/- ##
=======================================
Coverage 95.78% 95.78%
=======================================
Files 9 9
Lines 949 949
Branches 386 387 +1
=======================================
Hits 909 909
Misses 36 36
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexander-akait
deleted the
claude/filter-errors-quadratic-sibling-dos-1tqe2l
branch
September 8, 2026 12:33
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.
Recreates #210 by @laymonage, rebased on
main, with the original commit kept as a co-author. Fixes #209.Summary
import.meta.resolve()returns afile://URL, so passing one to an option that takes an absolute path failed validation. TheabsolutePathkeyword accepts an optionalfile://prefix now:What kind of change does this PR introduce?
A feature, plus test coverage for it.
Did you add tests for your changes?
Yes. Beyond the two cases from the original PR, every option of webpack's own schema that takes an absolute path is covered - the point being to verify the support against a real consumer rather than the fixture schema alone.
Walking
webpack/schemas/WebpackOptions.jsonfrom the root and resolving$refs gives 34 reachable options that useabsolutePath: true, and each one now has a test that afile://URL validates for it:context,recordsPath,recordsInputPath,recordsOutputPathoutputoutput.pathcachecacheDirectory,cacheLocation,immutablePaths,managedPathssnapshotimmutablePaths,managedPaths,unmanagedPathsmodulenoParseandnoParse[]; for bothrulesanddefaultRules:test,include,exclude,issuer,resource,realResource,resolve.restrictionsresolveresolve.restrictions,resolveLoader.restrictionsexperimentsbuildHttp.cacheLocation,buildHttp.lockfileLocationdotenv.dir,stats.contextAll 34 fail without the change to
absolutePath.jsand pass with it, so they are covering the behaviour rather than passing by accident.Does this PR introduce a breaking change?
One small behaviour change, covered by its own tests: an option that takes a relative path (
output.filename,output.sourceMapFilename,output.assetModuleFilenameand friends, which useabsolutePath: false) used to accept afile://value, because it did not look absolute. Such a value is recognised as absolute now and is rejected for those options, which is what they mean. The changeset is aminorand calls it out.If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing - as in the original PR, there are no docs for the absolute path keyword.
🤖 Generated with Claude Code
https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK
Generated by Claude Code