Skip to content

worker-build: leave the Emscripten glue unminified - #1131

Merged
JesusFileto merged 1 commit into
cloudflare:mainfrom
JesusFileto:js-glue-source-maps
Nov 12, 2026
Merged

JesusFileto merged 1 commit into
cloudflare:mainfrom
JesusFileto:js-glue-source-maps

Conversation

@JesusFileto

@JesusFileto JesusFileto commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Since #1137, wrangler bundles worker-build's output and uploads a source map for it, so frames in the shim, the wasm-bindgen glue and build/snippets/, including inline_js, already resolve to their own files and lines, with function names kept. Emscripten builds are the exception: emcc minifies its own glue at -O2 into a single line, so every frame in it maps to that line plus a column, under the short names emcc gave its functions. Linking with --minify=0 gives those frames real lines and names: new PanicError maps to build/index_bg.js:2904:10 instead of build/index_bg.js:4:47386. The .wasm and its source map don't change.

@guybedford

Copy link
Copy Markdown
Member

I've posted #1137 as an alternative here which entirely removes the need for esbuild. Might be simpler to lean entirely only on the one run in wrangler?

@JesusFileto

Copy link
Copy Markdown
Contributor Author

I've posted #1137 as an alternative here which entirely removes the need for esbuild. Might be simpler to lean entirely only on the one run in wrangler?

Yes this is a way better alternative than this PR and just using the esbuild in wrangler. Emscripten may still need to pass a no minify flag to let esbuild perform minification so leaving that commit here and will edit the description once #1137 passes.

@guybedford

Copy link
Copy Markdown
Member

Sounds good, #1137 has now landed on main.

emcc minifies its glue onto one line, so wrangler's source map points
every glue frame at that line under emcc's short names. With
--minify=0 they get real lines and names.
@JesusFileto JesusFileto changed the title worker-build: write a source map for the bundled JavaScript worker-build: leave the Emscripten glue unminified Nov 12, 2026
@JesusFileto
JesusFileto merged commit 103f181 into cloudflare:main Nov 12, 2026
10 checks passed
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.

2 participants