fix(plugins): convert plugin path to file:// URL for ESM import on Windows#3967
Closed
Chen-538 wants to merge 1 commit into
Closed
fix(plugins): convert plugin path to file:// URL for ESM import on Windows#3967Chen-538 wants to merge 1 commit into
Chen-538 wants to merge 1 commit into
Conversation
…ndows Dynamic `import(indexPath)` failed on Windows with `ERR_UNSUPPORTED_ESM_URL_SCHEME` because Node's ESM loader treats the drive letter (`c:`) as a URL protocol. POSIX absolute paths happened to work, masking the issue. Use `pathToFileURL(indexPath).href` so the loader receives a valid `file://` URL on all platforms. Behavior on POSIX is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Shipped in v1.11 — thank you! We merged the Windows ESM plugin loading fix using Release notes: https://github.com/jo-inc/camofox-browser/releases/tag/v1.11.0 |
Contributor
|
Closing since this shipped via #4150 in v1.11. |
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.
Summary
On Windows,
npm startfails to load any plugin with:lib/plugins.jspasses a raw absolute path (e.g.C:\...\plugins\persistence\index.js) toawait import(...). Node's ESM loader interprets the drive letter as a URL scheme and rejects it. POSIX absolute paths (/...) happen to work, which masked the issue.Fix: convert the path with
pathToFileURL(indexPath).hrefso the loader always receives a validfile://URL.Repro
npm install && npm startplugin load failedforpersistence,vnc,youtubeAfter this PR
All three plugins load cleanly on Windows. POSIX behavior is unchanged — Node accepts both absolute paths and
file://URLs equivalently for dynamicimport().Test plan
npm testplugin and unit suites pass (659/660; one remaining failure is an unrelated pre-existing Windows test expectingcamoufox-binwithout the.exesuffix)POST /tabsagainstexample.comsucceeds end-to-end on Windows