Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Import bytes proposal#17817

Open
nicolo-ribaudo wants to merge 1 commit intobabel:mainfrom
nicolo-ribaudo:import-bytes-proposal
Open

Import bytes proposal#17817
nicolo-ribaudo wants to merge 1 commit intobabel:mainfrom
nicolo-ribaudo:import-bytes-proposal

Conversation

@nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

First commit is from #17816.

This PR adds support for the https://github.com/tc39/proposal-import-bytes proposal. I'm calling the plugin proposal-bytes-modules, for consistency with transform-json-modules.

@nicolo-ribaudo nicolo-ribaudo added PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Needs Docs labels Feb 20, 2026
@babel-bot
Copy link
Collaborator

babel-bot commented Feb 20, 2026

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61048

Comment on lines +1 to +2
// TODO: Not supported yet
let promise = import("./x", { with: { type: "bytes" } });
Copy link
Member Author

Choose a reason for hiding this comment

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

We also do not support this for JSON yet.

Comment on lines +1 to +2
const json = await fetch(import.meta.resolve("./x")).then(r => r.json());
const bytes = await fetch(import.meta.resolve("./x")).then(r => r.bytes()).then(_immutableUint8Array);
Copy link
Member Author

Choose a reason for hiding this comment

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

The same currently happens with WASM+JSON imports. I'll look into making them happen in parallel, like JSON+JSON.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 20, 2026

Open in StackBlitz

commit: 72b9365

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

Labels

PR: Needs Docs PR: New Feature 🚀 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants