Skip to content

worker-build: keep the Wasm source phase import - #1136

Merged
guybedford merged 1 commit into
mainfrom
gbedford/import-source
Nov 11, 2026
Merged

guybedford merged 1 commit into
mainfrom
gbedford/import-source

Conversation

@guybedford

Copy link
Copy Markdown
Member

This removes the worker-build post-bundle step that rewrote the Wasm source phase import in build/index.js into a plain import.

wasm-bindgen's --target module output obtains the compiled module with a source phase import, which workerd and Wrangler did not accept when this target was adopted, so the bundle was patched after esbuild ran. Both now support the syntax, so the output can be left as generated.

Before:

import wasmModule from "./index_bg.wasm";

After:

import source wasmModule from "./index_bg.wasm";

Checked against workerd 1.20261110.1 (no compatibility date or flag dependence) and wrangler deploy --dry-run on 4.141.0 and 4.160.1, both bundled and with --no-bundle on the latter. Projects on a Wrangler whose esbuild does not parse import source will need to upgrade.

@guybedford
guybedford merged commit c9751ca into main Nov 11, 2026
12 of 13 checks passed
@guybedford
guybedford deleted the gbedford/import-source branch November 11, 2026 20:33
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.

1 participant