Repository navigation
fix(core): keep Node's format for data: URL imports - #852
Merged
Merged
Conversation
The resolve hook short-circuited `data:` specifiers with the format `builtin`, so Node.js looked the URL up as a built-in module and every `data:` import failed with ERR_UNKNOWN_BUILTIN_MODULE. Keep the format Node.js derives from the MIME type instead. Closes #841 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
βΉοΈ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with π while any review is running, comments if it has suggestions, and reacts with π once all reviews finish with no findings. |
With a `registerHooks()` load hook in the chain, Node.js rejects its own `null` format for an unknown `data:` MIME type as ERR_INVALID_RETURN_PROPERTY_VALUE instead of ERR_UNKNOWN_MODULE_FORMAT; a pass-through JavaScript hook does the same. The test only needs the import to fail. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #841
Problem
The resolve hook short-circuited
data:specifiers with the formatbuiltin. Node.js then looked the URL up as a built-in module, so everydata:import failed:Fix
The
data:branch still short-circuits, but now passes no format, soadd_short_circuitkeeps the format Node.js'nextResolvederives from the MIME type. The load hook already leavesdata:URLs to Node.js.Tests
packages/integrate-vitest/__tests__/data-urls.spec.tscovers:text/javascriptimportstext/javascriptimportapplication/jsonimport withtype: 'json'text/plain, which still fails withERR_UNKNOWN_MODULE_FORMAT, as in plain Node.jsThe test fails on
mainat the first import withERR_UNKNOWN_BUILTIN_MODULE.Verification (macOS arm64, Node 24.22)
The same script prints the same output under plain
node,node --import @oxc-node/core/registerand the CLI, including uppercaseDATA:.cargo test --all-features,cargo clippy --all-targets --all-features -- -D warnings,vp run test(217 passed) andvp run lintall pass.π€ Generated with Claude Code