Repository navigation
Conversation
With --minified-only, wp-build skips the non-minified bundles, which WordPress loads only when SCRIPT_DEBUG is true, and the source maps of the minified bundles. This covers the scripts, the script modules, the routes and the widgets. The transpiled package output in build/ and build-module/ is unchanged. Without the option the output is byte-identical to trunk (diff -r over the paths the E2E workflow uploads). With it, 363 files are not written, all under build/: 105 non-minified bundles with their source maps and the source maps of the 105 minified bundles (scripts and modules), plus 48 non-minified route and widget bundles. The minified bundles lose their sourceMappingURL comment, so the content hash in each .min.asset.php changes; nothing else differs. The option is parsed at module level, next to the other build switches, because the non-minified builds happen in bundlePackage(), buildRoute() and buildWidget(), which watch mode also calls.
The Playwright jobs run against .wp-env.test.json, which sets SCRIPT_DEBUG to false, so WordPress loads the .min.js bundles and nothing reads the non-minified bundles or the source maps. Build with --minified-only to skip them.
Sets `if: false` on every job of every workflow that runs on pull_request, except end2end-test.yml, so the run measures the E2E Build job and the Playwright jobs alone. Drop before merge.
🤖 PR meta 🤖🎉 PropsIf 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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 9.05 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
|
Build job timings on
Phases 2 to 4, which contained the skipped builds, take 55% to 63% less time: their medians drop by 31.5 s in total, and the Peak memory does not appear in the job log. Locally (Apple M5 Max, 18 cores), the summed resident memory of the build's process tree, sampled every 0.25 s, peaked at 9.7 GB and 8.1 GB in two default builds and at 5.8 GB and 4.9 GB in two All 10 Playwright jobs passed in each of the three attempts. The flaky test report lists tests that failed once and passed on retry: |
This reverts commit 3f435fa.
Leave the parseArgs() call in main(), where trunk has it, and store the flag in a module-level variable that main() sets before buildAll() and watchMode() run.
Both tests fail with a TypeError thrown from serializeBlock() in the wp-blocks bundle, once through page.evaluate() and once as an uncaught page error, so the CI report shows whether Playwright maps the stack trace through the bundle's source map. Drop before merge.
Restores trunk's sourcemap settings for the minified scripts and script modules, so the E2E run shows whether the failing probe spec reports source-mapped stack traces when the maps are present. Drop before merge.
This reverts commit 436d788.
…bundle" This reverts commit a8e68d0.
|
I think some folks from Jetpack were asking for this option as well and have an alternative PR. Not just for e2e test but also for their own production builds. So let's make sure it fits both use-cases and consider the earlier PR. |
|
I think it's this PR #75396 |
|
Something that has come up since we were looking at #75396 is the problem of i18n. GlotPress only scans the non-minified filename (or the Given our experience with producing GlotPress-compatible minified bundles from Webpack+terser, I'd expect that, even if we renamed the |
|
My main driver here was to reduce memory and prevent out-of-memory build failures on CI. With #79889, I believe that's resolved. I don't have a pressing need for this now. |
|
Closing in favor of #75396. |
What?
Adds a
--minified-onlyoption towp-buildand uses it in the End-to-End Tests workflow's Build job, so that job builds only what the Playwright tests load.Why?
Faster builds on CI, lower memory consumption. This is especially important for any private repo forks with less powerful CI runners.
The Playwright jobs run against
.wp-env.test.json, which setsSCRIPT_DEBUGto false, so WordPress loads only the.min.jsbundles. The Build job still bundles a non-minified copy of every script, script module, route and widget, and writes source maps for the scripts and script modules. These files go into the build artifact and nothing reads them. Phase 2 of the build starts every bundle at once, so these builds add to the job's time and peak memory, and the files add to the artifact upload.With the option, the
Npm buildstep's median falls from 105 s to 63 s and the artifact from 124 MB to 81 MB; the comparison with recent upstream runs is in #85252 (comment).How?
wp-build --minified-onlyskips the non-minified bundles (index.jsfor scripts,*.jsfor script modules,route.jsandcontent.jsfor routes,render.jsandwidget.jsfor widgets) and the source maps of the minified bundles. The transpiled package output (packages/*/build,packages/*/build-module) and the styles are unchanged.bundlePackage(),buildRoute()andbuildWidget(), which watch mode also calls.npm run build -- --minified-only.Without the option, the output is byte-identical to trunk: I built trunk and this branch and compared the paths the E2E workflow uploads with
diff -r. With it, 363 files underbuild/are not written: 105 non-minified script and module bundles, their 105 source maps, the 105 source maps of the minified bundles, and 48 non-minified route and widget bundles. The minified bundles lose their trailingsourceMappingURLcomment, so the content hash in each.min.asset.phpchanges. Nothing else differs. The uploaded paths shrink from 627 MB to 419 MB locally.The
DROPME:commit setsif: falseon every other job that runs on pull requests, so this PR's CI runs only the E2E workflow. It is for measurement and is dropped before merge.Testing Instructions
npm run build -- --minified-only.build/scripts/*/index.min.jsandindex.min.asset.phpexist;build/scripts/*/index.jsand everybuild/**/*.mapdo not.npm run build. The output matches trunk's.Testing Instructions for Keyboard
Not applicable: no UI change.
Use of AI Tools
AI assistance: Yes
Tools: Claude Code
Model: Claude Opus 5.5
Used for: implementation, the build output comparison, the CI measurements and this description.