Skip to content

feat: allow file:// protocol prefix in absolute paths - #210

Closed
laymonage wants to merge 1 commit into
webpack:mainfrom
laymonage:feature/allow-file-protocol-in-absolute-path
Closed

laymonage wants to merge 1 commit into
webpack:mainfrom
laymonage:feature/allow-file-protocol-in-absolute-path

Conversation

@laymonage

Copy link
Copy Markdown
Contributor

Summary

Fixes #209

What kind of change does this PR introduce?

This allows an optional file:// protocol prefix for absolute paths, such as those returned by import.meta.resolve().

Did you add tests for your changes?

Yes.

Does this PR introduce a breaking change?

Not that I know of.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

I couldn't find docs for the absolute path functions, so I didn't add any.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Feb 17, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: laymonage / name: S​age Abdullah (6651088)

Comment thread test/index.test.js
Comment on lines +332 to +334
createSuccessTestCase("absolutePath #7", {
testAbsolutePath: "file:///C:/directory/deep/tree",
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's sufficient for Windows.

Seems OK based on nodejs/node#20080 and https://en.wikipedia.org/wiki/File_URI_scheme#Windows, but I haven't tested it myself

alexander-akait added a commit that referenced this pull request Sep 8, 2026
* feat: allow `file://` protocol prefix in absolute paths

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 <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK

* test: cover every webpack option that takes an absolute path

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 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK

* chore: add a changeset for the `file://` prefix

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK

* chore: link the changeset to the pull request

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wqLmVHkAGBsWQgXknEQCK

---------

Co-authored-by: Sage Abdullah <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
@alexander-akait

Copy link
Copy Markdown
Member

Sorry for big delay, fixed in the main with co-author, found some bugs on webpack side too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support absolute paths with file:// protocol prefix

2 participants