Build: Skip sourcemaps for WASM-inlined script module workers#75993
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@adamsilverstein, have you tested with We might have to add special handling for this file. Here's a related discussion - #75396. |
Thanks for flagging — that's interesting, that case is about an environment-based flag (i.e. running a production build), whereas this case is about the package itself having an opinion on how it's built. I wonder if there's a way to combine these concepts / features into a single idea. Or failing that, closely related ones 🤔 |
That makes sense. My local is loading the core version now on trunk, so I need to test against 6.9. |
|
I verified this is causing an issue with 6.9, working on it. |
|
Thanks for the confirmation, @adamsilverstein! I think we'll have the same issue with 7.0 once changes are synced. |
|
What's the reasoning for wanting to skip these files. What is special for these packages compared to all the other ones? |
Their very large size. This fixes https://core.trac.wordpress.org/ticket/64734 see that ticket for details. @youknowriad - If preferable we can ship these files with Gutenberg, but omit them during the WordPress build process. what do you think? |
I'm not sure, I see Gutenberg as alpha, so I believe we should do the same. It seems like the "wasm" package is a good enough differentiation to consider it special. -- Should we name the flag |
that makes sense, and i assume the default is true since we normally do support debugging by outputting map files and unminified versions. |
|
I started working on a simpler solution for core since we probably need to adjust loading there as well to always use the minified VIPS file: WordPress/wordpress-develop#11109 |
The previous commit added wpScriptModuleMinifiedOnly to package.json but didn't pass the flag through to the PHP registry data. Without the minified_only entry in the registry, the PHP template couldn't override the .js extension when SCRIPT_DEBUG is on, causing module resolution failures for packages that only ship .min.js files.
|
Flaky tests detected in 43735c6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23452985817
|
Broadens the flag to cover all build outputs (scripts, script modules, and styles) instead of just script modules. When set to false, skips unminified builds and sourcemaps for all output types. Adds file_exists fallbacks in script and style PHP templates so SCRIPT_DEBUG gracefully falls back to minified files when unminified versions don't exist.
The file_exists fallback in the PHP template handles missing unminified files generically, making the per-module minified_only flag in the registry unnecessary.
- Collapse multiline `skipDebugBuilds` assignments to single lines (prettier) - Re-align JSDoc @typedef/@Property columns in package-utils.mjs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This is looking good for me. |
|
@adamsilverstein is this still needed after the recent work to shrink the related source? |
|
Maybe not? We might still want it to reduce Gutenberg's package size. |
we do still want this PR: Plugin ZIP Size
Build Directory
What the PR still removes vs current trunkThe recent PRs (#76615, #76639, #76657) already landed the unminified worker skip, JXL WASM removal, and SCRIPT_DEBUG fallback. What this PR still does on top of trunk:
The remaining value of this PR is removing source maps from the vips build output, which saves ~13 MB from the build directory and ~6 MB from the plugin ZIP. The non-vips source maps (5.8 MB) are still present in both builds. |
Resolve conflicts with #76615 and #76657 which landed the unminified worker skip and SCRIPT_DEBUG fallback. Keep trunk's isWasmWorker/min_only approach and add sourcemap suppression for WASM workers. Remove the unused wpScriptDebugSupport flag and related dead code paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@youknowriad can you please approve this if it looks good to you? |
|
This worked well in my local testing. |
Summary
Suppresses source map generation for WASM-inlined worker builds (currently only
@wordpress/vips/worker). The worker is ~13MB of base64-encoded WASM data where source maps provide no debugging value, yet the.mapfile is nearly the same size (~13MB).This builds on #76615 (skip unminified worker build) and #76639 (remove unused JXL WASM) which already landed on trunk.
Size impact
build/modules/vips/What changed
The only functional change is setting
sourcemap: ! isWasmWorkerin the esbuild config for script module builds. This skips generatingworker.min.js.map(~13MB) and the unminified loader's.mapfiles for packages whose exports correspond towpWorkersentries.Files removed from
build/modules/vips/worker.min.js.maploader.js.maploader.min.js.maploader.js(unminified)worker.js(unminified)vips-jxl.wasm(inlined)Context
Fixes #64734
See also:
Test plan
npm run build— verifybuild/modules/vips/contains onlyworker.min.js,loader.min.js, and*.asset.php(no.mapfiles)ls build/modules/interactivity/)