Skip to content

Migrate from esbuild to rolldown - #85476

Merged
jsnajdr merged 5 commits into
trunkfrom
try/wp-build-rolldown
Oct 26, 2026
Merged

jsnajdr merged 5 commits into
trunkfrom
try/wp-build-rolldown

Conversation

@jsnajdr

@jsnajdr jsnajdr commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Claude-generated migration from esbuild to Rolldown. Looks like a great upgrade.

The built scripts are much smaller, on average about 10%.

Big improvement in perf metrics, especially the "load-like" ones: domContentLoaded is down by 30%, firstBlock by 10%. Both for Site Editor and Post Editor.

We don't need any workarounds for bundler quirks. #79792 wrapped scripts in an IIFE because of use strict, and Rolldown does this correctly out of the box. #85180 and #85181 fixes inefficienies in ES module export getters, and Rolldown also does this efficiently already.

The PR itself is quite small.

@jsnajdr jsnajdr self-assigned this Oct 23, 2026
@jsnajdr jsnajdr added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 23, 2026
@github-actions github-actions Bot added the [Package] wp-build /packages/wp-build label Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -511 kB (-5.63%) ✅

Total Size: 8.55 MB

📦 View Changed
Filename Size Change
build/modules/a11y/index.min.js 354 B -3 B (-0.84%)
build/modules/abilities/index.min.js 41.2 kB -3.55 kB (-7.93%) ✅
build/modules/block-editor/utils/fit-text-frontend.min.js 615 B -7 B (-1.13%)
build/modules/block-library/accordion/view.min.js 577 B -27 B (-4.47%)
build/modules/block-library/file/view.min.js 349 B +3 B (+0.87%)
build/modules/block-library/image/view.min.js 3.4 kB -78 B (-2.25%)
build/modules/block-library/navigation/view.min.js 1.16 kB +3 B (+0.26%)
build/modules/block-library/playlist/view.min.js 18.1 kB -345 B (-1.87%)
build/modules/block-library/query/view.min.js 519 B +1 B (+0.19%)
build/modules/block-library/search/view.min.js 501 B +3 B (+0.6%)
build/modules/block-library/tabs/view.min.js 857 B -7 B (-0.81%)
build/modules/boot/index.min.js 50.9 kB -7 kB (-12.1%) 👏
build/modules/connectors/index.min.js 2.22 kB -271 B (-10.87%) 👏
build/modules/core-abilities/index.min.js 946 B +39 B (+4.3%)
build/modules/core-actions/page.min.js 1.48 kB -350 B (-19.15%) 👏
build/modules/core-actions/post_type_supports.min.js 5.25 kB -959 B (-15.45%) 👏
build/modules/core-actions/wp_block.min.js 6.2 kB -151 B (-2.38%)
build/modules/core-actions/wp_template_part.min.js 924 B -305 B (-24.82%) 🎉
build/modules/core-fields/attachment.min.js 39.3 kB -6.07 kB (-13.38%) 👏
build/modules/core-fields/page.min.js 6.23 kB -93 B (-1.47%)
build/modules/core-fields/post_type_supports.min.js 73.3 kB -8.5 kB (-10.39%) 👏
build/modules/core-fields/root_site.min.js 492 B -258 B (-34.4%) 🎉
build/modules/core-fields/wp_block.min.js 34.6 kB -5.68 kB (-14.11%) 👏
build/modules/core-fields/wp_template_part.min.js 34.4 kB -5.78 kB (-14.37%) 👏
build/modules/core-fields/wp_template.min.js 7.4 kB -206 B (-2.71%)
build/modules/dashboard-init/index.min.js 10.9 kB -558 B (-4.85%) ✅
build/modules/edit-site-init/index.min.js 1.3 kB -396 B (-23.29%) 🎉
build/modules/interactivity-router/full-page.min.js 454 B +3 B (+0.67%)
build/modules/interactivity-router/index.min.js 12.3 kB -52 B (-0.42%)
build/modules/interactivity/index.min.js 15.1 kB -638 B (-4.05%)
build/modules/latex-to-mathml/index.min.js 56.8 kB -61 B (-0.11%)
build/modules/latex-to-mathml/loader.min.js 129 B -2 B (-1.53%)
build/modules/lazy-editor/index.min.js 14.3 kB -901 B (-5.91%) ✅
build/modules/route/index.min.js 23.7 kB -1.51 kB (-5.98%) ✅
build/modules/video-conversion/loader.min.js 134 B -1 B (-0.74%)
build/modules/video-conversion/worker.min.js 85.9 kB +1.83 kB (+2.17%)
build/modules/vips/loader.min.js 126 B -1 B (-0.79%)
build/modules/vips/worker.min.js 3.79 MB +36 kB (+0.96%)
build/modules/widget-primitives/index.min.js 2.04 kB -299 B (-12.81%) 👏
build/modules/workflow/index.min.js 41 kB -48.2 kB (-54.02%) 🏆
build/scripts/a11y/index.min.js 966 B -235 B (-19.57%) 🎉
build/scripts/annotations/index.min.js 2.16 kB -474 B (-18%) 👏
build/scripts/api-fetch/index.min.js 2.92 kB -640 B (-18%) 👏
build/scripts/autop/index.min.js 1.95 kB -375 B (-16.14%) 👏
build/scripts/base-styles/index.min.js 120 B -157 B (-56.68%) 🏆
build/scripts/blob/index.min.js 449 B -318 B (-41.46%) 🎉
build/scripts/block-directory/index.min.js 42.6 kB -12.9 kB (-23.18%) 🎉
build/scripts/block-editor/index.min.js 541 kB -65.5 kB (-10.8%) 👏
build/scripts/block-library/index.min.js 404 kB -45.5 kB (-10.13%) 👏
build/scripts/block-serialization-default-parser/index.min.js 982 B -330 B (-25.15%) 🎉
build/scripts/block-serialization-spec-parser/index.min.js 3.01 kB -240 B (-7.38%) ✅
build/scripts/blocks/index.min.js 44.8 kB -1.74 kB (-3.74%)
build/scripts/commands/index.min.js 20.1 kB -1.88 kB (-8.56%) ✅
build/scripts/components/index.min.js 329 kB -43.7 kB (-11.74%) 👏
build/scripts/compose/index.min.js 10.6 kB -1.1 kB (-9.4%) ✅
build/scripts/core-commands/index.min.js 3.27 kB -782 B (-19.28%) 👏
build/scripts/core-data/index.min.js 76.7 kB -2.74 kB (-3.45%)
build/scripts/customize-widgets/index.min.js 22.7 kB -37.8 kB (-62.45%) 🏆
build/scripts/data-controls/index.min.js 695 B -240 B (-25.67%) 🎉
build/scripts/data/index.min.js 9.41 kB -843 B (-8.22%) ✅
build/scripts/date/index.min.js 23.4 kB -398 B (-1.67%)
build/scripts/deprecated/index.min.js 369 B -510 B (-58.02%) 🏆
build/scripts/dom-ready/index.min.js 218 B -384 B (-63.79%) 🏆
build/scripts/dom/index.min.js 5.18 kB -264 B (-4.85%) ✅
build/scripts/edit-post/index.min.js 45.2 kB -7.59 kB (-14.37%) 👏
build/scripts/edit-site/index.min.js 376 kB -48.5 kB (-11.43%) 👏
build/scripts/edit-widgets/index.min.js 29 kB -38.5 kB (-57.03%) 🏆
build/scripts/editor/index.min.js 555 kB -65 kB (-10.47%) 👏
build/scripts/element/index.min.js 5.13 kB -250 B (-4.65%) ✅
build/scripts/escape-html/index.min.js 400 B -328 B (-45.05%) 🎉
build/scripts/format-library/index.min.js 79.2 kB -11 kB (-12.18%) 👏
build/scripts/hooks/index.min.js 1.59 kB -380 B (-19.31%) 👏
build/scripts/html-entities/index.min.js 314 B -321 B (-50.55%) 🏆
build/scripts/i18n/index.min.js 2.15 kB -455 B (-17.45%) 👏
build/scripts/is-shallow-equal/index.min.js 401 B -308 B (-43.44%) 🎉
build/scripts/keyboard-shortcuts/index.min.js 1.35 kB -444 B (-24.78%) 🎉
build/scripts/keycodes/index.min.js 1.35 kB -473 B (-25.99%) 🎉
build/scripts/list-reusable-blocks/index.min.js 4.2 kB -265 B (-5.93%) ✅
build/scripts/media-utils/index.min.js 231 kB -34.5 kB (-13.01%) 👏
build/scripts/notices/index.min.js 45.7 kB -7.21 kB (-13.63%) 👏
build/scripts/nux/index.min.js 867 B -141 B (-13.99%) 👏
build/scripts/patterns/index.min.js 12.9 kB -1.55 kB (-10.78%) 👏
build/scripts/plugins/index.min.js 2.63 kB -680 B (-20.53%) 🎉
build/scripts/preferences-persistence/index.min.js 2.16 kB -231 B (-9.67%) 👏
build/scripts/preferences/index.min.js 2.97 kB -475 B (-13.79%) 👏
build/scripts/primitives/index.min.js 706 B -446 B (-38.72%) 🎉
build/scripts/priority-queue/index.min.js 1.36 kB -391 B (-22.27%) 🎉
build/scripts/private-apis/index.min.js 967 B -309 B (-24.22%) 🎉
build/scripts/react-i18n/index.min.js 514 B -451 B (-46.74%) 🎉
build/scripts/redux-routine/index.min.js 2.62 kB -868 B (-24.87%) 🎉
build/scripts/reusable-blocks/index.min.js 847 B -159 B (-15.81%) 👏
build/scripts/rich-text/index.min.js 14.5 kB -1.07 kB (-6.9%) ✅
build/scripts/router/index.min.js 5.49 kB -627 B (-10.26%) 👏
build/scripts/server-side-render/index.min.js 1.82 kB -405 B (-18.17%) 👏
build/scripts/shortcode/index.min.js 1.33 kB -388 B (-22.56%) 🎉
build/scripts/style-engine/index.min.js 2.25 kB -532 B (-19.14%) 👏
build/scripts/theme/index.min.js 26.9 kB -1.25 kB (-4.44%)
build/scripts/token-list/index.min.js 488 B -377 B (-43.58%) 🎉
build/scripts/undo-manager/index.min.js 614 B -441 B (-41.8%) 🎉
build/scripts/upload-media/index.min.js 16 kB -1.13 kB (-6.63%) ✅
build/scripts/url/index.min.js 3.54 kB -268 B (-7.04%) ✅
build/scripts/viewport/index.min.js 910 B -450 B (-33.09%) 🎉
build/scripts/warning/index.min.js 218 B -362 B (-62.41%) 🏆
build/scripts/widgets/index.min.js 64.1 kB -8.49 kB (-11.69%) 👏
build/scripts/wordcount/index.min.js 860 B -324 B (-27.36%) 🎉

70b7bd0 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 75e7b0b trunk % Change
timeToFirstByte 54.8 ms +3.92% -4.2% 56.25 ms +4.8% -6.58% -2.58%
largestContentfulPaint 92 ms +10.87% -4.35% 96 ms +4.17% -6.25% -4.17%
lcpMinusTtfb 36 ms +24.03% -2.08% 39.2 ms +11.61% -10.59% -8.16%
wpBeforeTemplate 29.42 ms +9.35% -2.65% 29.62 ms +10.09% -4.79% -0.68%
wpTemplate 20.68 ms +7.35% -3.09% 21.24 ms +3.53% -4.9% -2.64%
wpTotal 50.66 ms +5.03% -3.49% 52.35 ms +5.43% -6.55% -3.23%
wpMemoryUsage 7.68 MB +0% -0% 7.65 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 75e7b0b trunk % Change
timeToFirstByte 48.05 ms +3.43% -4.99% 46.55 ms +5.91% -2.69% 3.22%
largestContentfulPaint 104 ms +1.92% -3.85% 100 ms +4% -0% 4%
lcpMinusTtfb 55.05 ms +1.91% -1.27% 54.9 ms +4.64% -1.64% 0.27%
wpBeforeTemplate 27.31 ms +6.77% -2.34% 27.24 ms +4.26% -3.23% 0.26%
wpTemplate 16.26 ms +5.72% -1.91% 16.31 ms +5.27% -2.82% -0.31%
wpTotal 44.66 ms +3.92% -4.39% 43.64 ms +5.75% -3.05% 2.34%
wpMemoryUsage 6.37 MB +0% -0% 6.34 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 75e7b0b trunk % Change
mediaProcessingJpeg 401.15 ms +0.52% -0.46% 402.29 ms +0.4% -1.35% -0.28%
mediaProcessingAvif 6058.71 ms +0.05% -0.16% 6070.06 ms +0.24% -0.28% -0.19%
mediaProcessingJpegToAvif 4187 ms +0.18% -0.04% 4178.6 ms +0.16% -0.25% 0.2%

media-upload

Metric 75e7b0b trunk % Change
jpegUploadProcessing 1472.8 ms +2.72% -1.4% 1445.65 ms +0.79% -0.49% 1.88%
pngUploadProcessing 186.79 ms +31.57% -6.07% 181.12 ms +11.64% -5% 3.13%
largeJpegUploadProcessing 1428.83 ms +1.54% -0.67% 1431.35 ms +0.22% -1.3% -0.18%
multipleImageUploadProcessing 1515.26 ms +0.86% -0.78% 1629.74 ms +23.64% -2.96% -7.02%

post-editor

Metric 75e7b0b trunk % Change
serverResponse 522.3 ms +1.01% -3.43% 505.3 ms +4.31% -4.66% 3.36%
firstPaint 382.16 ms +32.87% -37.95% 496.73 ms +9.82% -45.38% -23.06%
domContentLoaded 901.88 ms +0.78% -2.54% 1241.92 ms +1.77% -1.67% -27.38%
loaded 902.94 ms +0.8% -2.49% 1243.09 ms +1.78% -1.66% -27.36%
firstContentfulPaint 519.57 ms +1.16% -2.27% 526.71 ms +4.93% -7.73% -1.36%
firstBlock 3033.42 ms +3.59% -1.56% 3570.45 ms +1.8% -1.5% -15.04%
type 17.83 ms +7.85% -1.96% 17.25 ms +3.25% -2.96% 3.36%
typeWithoutInspector 16.95 ms +5.6% -2.12% 18.88 ms +5.46% -3.6% -10.22%
typeWithTopToolbar 22.06 ms +2.22% -3.26% 24.39 ms +2.17% -5.54% -9.55%
typeContainer 7.77 ms +13.64% -6.44% 8.36 ms +8.85% -4.19% -7.06%
focus 122.35 ms +9.29% -8.21% 117.39 ms +16.02% -3.38% 4.23%
firstFocus 237.99 ms +0% -0% 236.15 ms +0% -0% 0.78%
selectAll 463.51 ms +5.35% -0.86% 560.1 ms +1.56% -2.98% -17.25%
listViewOpen 75.55 ms +23.35% -9.58% 75.79 ms +12.82% -5.87% -0.32%
inserterOpen 40.11 ms +6.01% -8.18% 39.63 ms +12.72% -10.02% 1.21%
inserterHover 11 ms +6.82% -6.73% 12.04 ms +7.81% -7.81% -8.64%
inserterSearch 8.67 ms +4.84% -13.26% 7.68 ms +10.81% -2.6% 12.89%
loadPatterns 629.32 ms +5.05% -5.99% 652.35 ms +2.2% -3.11% -3.53%
wpTotal 513.05 ms +0.64% -3.61% 495.42 ms +4.43% -4.81% 3.56%
wpMemoryUsage 14.71 MB +0% -0% 14.68 MB +0% -0% 0.24%
wpDbQueries 55 +0% -1.82% 54.5 +0.92% -0.92% 0.92%

site-editor

Metric 75e7b0b trunk % Change
serverResponse 405.59 ms +1.57% -2.79% 404.24 ms +4.12% -2.29% 0.33%
firstPaint 224.16 ms +11.57% -4.55% 245.88 ms +8.09% -9.43% -8.83%
domContentLoaded 852.37 ms +0.26% -1.21% 1216.74 ms +1.54% -0.94% -29.95%
loaded 853.27 ms +0.31% -1.21% 1217.94 ms +1.54% -0.94% -29.94%
firstContentfulPaint 476.92 ms +2.1% -3.13% 488.24 ms +3.56% -18.03% -2.32%
firstBlock 3885.61 ms +0.55% -0.23% 4287.13 ms +0.62% -0.79% -9.37%
type 17.51 ms +3.14% -2.57% 18.12 ms +1.27% -2.26% -3.37%
navigate 111.92 ms +0.75% -3.25% 107.36 ms +13.3% -1.27% 4.25%
loadPatterns 1057.8 ms +3.27% -6.95% 1180.64 ms +8.2% -5.31% -10.4%
loadPages 1031.63 ms +0.84% -4.76% 1057.36 ms +5.16% -6.45% -2.43%
wpTotal 394.79 ms +1.75% -2.65% 393.74 ms +4.36% -2.34% 0.27%
wpMemoryUsage 12.73 MB +0% -0% 12.70 MB +0% -0% 0.24%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

70b7bd0 Run

🏁 Flaky tests

Some 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.

Custom Completer: should allow newlines after multiple option completions in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

  <!-- wp:paragraph -->
  <p>🫐 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
- <p>🫐 test</p>
+ <p>~🍎 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>🫐 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
- <p>🫐 test</p>
+ <p>~🍎 test</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p></p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:466:6
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
Undo restores the post selection when another synced entity is loaded in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:417:52
inserts a block in proper place after having clicked `Browse All` from inline inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Add block' })
    - locator resolved to <button type="button" aria-pressed="false" aria-haspopup="true" aria-expanded="false" aria-label="Add block" class="components-button block-editor-inserter__toggle is-next-40px-default-size has-icon">…</button>
  - attempting click action
    - waiting for element to be visible, enabled and stable
  - element was detached from the DOM, retrying

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:557:5
should create paragraph on Enter in quote block in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('option', { name: 'List', exact: true })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:751:67
should filter mentions by non-latin search terms in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 2 failed attempts.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → DELETE http://localhost:8891/wp-json/wp/v2/users/26?force=true&reassign=1
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 4d59d36c6b
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_da433b7faafd8180ebeb1624ceeeab7e=admin%7C1793193910%7CtU78makUvJ5KwfXmsatesWAC6USL2BqncE2eaDVgkQw%7C967b02460f88519931d3d772e87a89f165b34640dba00e4c55a0fcded970185f; wp-settings-time-1=1793021739

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.deleteUser (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:91:30)
    at map (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:51)
    at RequestUtils.deleteAllUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:5)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:73:3

should format text across blocks in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "b",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2170:41
should gradually multi-select in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 3
+ Received  + 7

  Array [
    Object {
-     "name": "core/column",
+     "attributes": Object {
+       "content": "1",
+       "dropCap": false,
      },
-   Object {
-     "name": "core/column",
+     "clientId": "d6edceb0-913e-4a01-821d-293f4426366b",
+     "innerBlocks": Array [],
+     "isValid": true,
+     "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:1151:5
should keep the list type when indenting an ordered list item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list {"ordered":true} -->
  <ol class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list {"ordered":true} -->
+ <li>ne<!-- wp:list {"ordered":true} -->
  <ol class="wp-block-list"><!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item --></ol>
  <!-- /wp:list --></li>
  <!-- /wp:list-item --></ol>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:916:52
should merge a following sibling list into the outermost list with Delete from a nested item (#77245) in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

@@ -8,11 +8,11 @@
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {
                  "attributes": Object {
-                   "content": "b‸",
+                   "content": "b",
                  },
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
@@ -25,11 +25,11 @@
    },
    Object {
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "‸1",
          },
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2854:41
should remove an anchored list when deleting its last item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -5,11 +5,11 @@
      },
      "innerBlocks": Array [
        Object {
          "attributes": Object {
            "anchor": "item",
-           "content": "x",
+           "content": "",
          },
          "name": "core/list-item",
        },
      ],
      "name": "core/list",

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2961:41
should select by dragging into nested block in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 0

  Array [
    1,
-   2,
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:568:5
should select by dragging in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
TimeoutError: locator.hover: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('[name="editor-canvas"]').contentFrame().getByRole('document', { name: 'Block: Paragraph' }).first()
    - locator resolved to <p role="document" data-empty="false" aria-multiline="true" aria-readonly="false" data-title="Paragraph" contenteditable="true" data-type="core/paragraph" aria-label="Block: Paragraph" data-wp-block-attribute-key="content" id="block-c2065fbf-e77b-41d3-9ae2-b2e3042a48e7" data-block="c2065fbf-e77b-41d3-9ae2-b2e3042a48e7" class="block-editor-rich-text__editable block-editor-block-list__block wp-block wp-block-paragraph rich-text">1</p>
  - attempting hover action
    2 × waiting for element to be visible and stable
      - element is visible and stable
      - scrolling into view if needed
      - done scrolling
      - <button id="_r_1p_" type="button" tabindex="-1" aria-label="Link" aria-pressed="false" aria-haspopup="true" aria-expanded="false" data-toolbar-item="true" class="components-button components-toolbar-button is-compact has-icon">…</button> from <div tabindex="-1" data-wp-c16t="true" data-wp-component="Popover" class="components-popover block-editor-block-popover block-editor-block-list__block-popover is-positioned is-unstyled">…</div> subtree intercepts pointer events
    - retrying hover action
    - waiting 20ms
    2 × waiting for element to be visible and stable
      - element is visible and stable
      - scrolling into view if needed
      - done scrolling
      - <button id="_r_1p_" type="button" tabindex="-1" aria-label="Link" aria-pressed="false" aria-haspopup="true" aria-expanded="false" data-toolbar-item="true" class="components-button components-toolbar-button is-compact has-icon">…</button> from <div tabindex="-1" data-wp-c16t="true" data-wp-component="Popover" class="components-popover block-editor-block-popover block-editor-block-list__block-popover is-positioned is-unstyled">…</div> subtree intercepts pointer events
    - retrying hover action
      - waiting 100ms
    17 × waiting for element to be visible and stable
       - element is visible and stable
       - scrolling into view if needed
       - done scrolling
       - <button id="_r_1p_" type="button" tabindex="-1" aria-label="Link" aria-pressed="false" aria-haspopup="true" aria-expanded="false" data-toolbar-item="true" class="components-button components-toolbar-button is-compact has-icon">…</button> from <div tabindex="-1" data-wp-c16t="true" data-wp-component="Popover" class="components-popover block-editor-block-popover block-editor-block-list__block-popover is-positioned is-unstyled">…</div> subtree intercepts pointer events
     - retrying hover action
       - waiting 500ms

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:524:20
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

Truncated. See the full report.

70b7bd0 Run

@jsnajdr
jsnajdr force-pushed the try/wp-build-rolldown branch 2 times, most recently from 5197b47 to b4e282b Compare October 24, 2026 18:57
@youknowriad

Copy link
Copy Markdown
Contributor

AI is amazing :)

@youknowriad

Copy link
Copy Markdown
Contributor

All tests passing is a great signal, I'm performing some quick AI checks (I won't pretend that I can read the full diff and understand it at this point)

@jsnajdr

jsnajdr commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

All tests passing is a great signal

One bad signal is the unusual flakiness of the e2e tests. Maybe the GitHub infra was unstable over the weekend, or it's something real. Hard to say.

@Mamaduka

Copy link
Copy Markdown
Member

@jsnajdr, I don't think it's related; the numbers are similar in other PRs, and I noticed the change after #85428 (comment).

@youknowriad

Copy link
Copy Markdown
Contributor

Is there a way to retry all the tests (reset the flakiness thing)

@youknowriad

Copy link
Copy Markdown
Contributor

According to my agent, this is the most potentially problematic difference: The npm CommonJS output drops "use strict" everywhere and loses __esModule on 29 package entries. Neither has been reported on the PR yet.

It doesn't feel that problematic to me because CommonJS output is really not that important these days, though I'm not sure.

@youknowriad

Copy link
Copy Markdown
Contributor

Also apparently, in the PR’s CommonJS build, all 22 data stores register an extra selector and an extra action named default. In base, none do. Calling select( 'core/notices' ).default() throws selector is not a function.

@jsnajdr
jsnajdr force-pushed the try/wp-build-rolldown branch from b51e406 to 18cff4c Compare October 26, 2026 09:06
@youknowriad

Copy link
Copy Markdown
Contributor

This fixes all three, and the CJS output then matches trunk:

+// Rolldown's `__toESM` gives namespace imports a `default` unless the module has
+// its own, even when flagged `__esModule`. Follow the flag alone, like esbuild.
+const TO_ESM_OWN_DEFAULT_CHECK = ' || !__hasOwnProp.call(mod, "default")';
+const esModuleInteropPlugin = {
+	name: 'es-module-interop',
+	renderChunk( code ) {
+		if ( ! code.includes( 'var __toESM = ' ) ) {
+			return null;
+		}
+		if ( ! code.includes( TO_ESM_OWN_DEFAULT_CHECK ) ) {
+			throw new Error( 'Unexpected Rolldown `__toESM` helper.' );
+		}
+		// A same-length replacement keeps the source map valid.
+		return {
+			code: code.replace( TO_ESM_OWN_DEFAULT_CHECK, ' '.repeat( TO_ESM_OWN_DEFAULT_CHECK.length ) ),
+			map: null,
+		};
+	},
+};
 						format: 'cjs',
+						esModule: true,
+						strict: true,
 						exports: 'named',
 						sourcemap: true,
+						plugins: [ esModuleInteropPlugin ],

@jsnajdr

jsnajdr commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

loses __esModule on 29 package entries

__esModule really matters only on modules that have a default export together with names ones. From our packages, only is-shalow-equal and api-fetch have this layout. And for both of them, I see that __esModule is defined in the build/index.cjs file. Maybe Rolldown does this correctly after all.

@youknowriad youknowriad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should ship this regardless of the CJS fixes or not.

@jsnajdr

jsnajdr commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

in the PR’s CommonJS build, all 22 data stores register an extra selector and an extra action named default

Yes, this is an unpleasant behavior of Rolldown's __toESM helper. Unfortunately it's quite justified. When Node.js imports a CJS module with an import statement, the ESM/CJS interop machinery adds default field pointing to module.exports, and on top of that it adds the named exports. Example:

> await import("./build/store/selectors.cjs");
[Module: null prototype] {
  default: Object [Module] { getNotices: [Function: getNotices] },
  getNotices: [Function: getNotices],
  'module.exports': Object [Module] { getNotices: [Function: getNotices] }
}

There's also a module.exports field. Everything is documented in https://nodejs.org/api/esm.html#commonjs-namespaces.

The conclusion is that enumerating the namespace object is unreliable. You'll get all the named exports (the selectors) but there is no guarantee that there are no extra fields.

Comment thread packages/wp-build/lib/build.mjs Outdated
Comment on lines +1476 to +1485
// Name each entry after its path in `src`, so the output mirrors it.
const entryPoints = Object.fromEntries(
srcFiles.map( ( file ) => [
normalizePath( path.relative( srcDir, file ) ).replace(
/\.[^./]+$/,
''
),
file,
] )
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This changes the order in which component styles are injected. With one multi-entry build per package, shared CSS modules move into _chunks/, and Rolldown hoists those imports above everything else and reorders the externals. In ui/build-module/button/button.mjs, the style chunks now load before @base-ui/react/button and ../spinner/index.mjs. Trunk keeps the source order.

The CSS itself is byte-identical, but it's injected in a different order in 33 of the 40 bundles that inject styles, wp-components included. @wordpress/ui is mostly safe thanks to @layer, but the @wordpress/components SCSS modules are unlayered, and only some of them are already hardened against insertion order. strictExecutionOrder and preserveModules don't restore it. One build per file mostly does (82 flipped pairs down to 4 in wp-components), but in my local runs the packages build went from about 14s to 26s, wiping out the speed gain.

The order also isn't deterministic: three clean builds of this branch gave different style orders in modules/core-fields/*.js, while trunk's output is identical across builds.

Is the order change intended? If so, can we mention it in the description and make the output deterministic?


(I haven't identified a clear style regression, so this is mostly just flagging a potential problem to look out for as we roll this out.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's a good catch. Rolldown doesn't inline the runtime (helpers like __toESM) and the style modules like ESbuild did, but puts them into shared chunks. And the shared chunk imports are then always at the top of the module, in a different order than they were in the original.

I disabled this and instructed Rolldown to inline everything just like ESbuild did. It won't be as efficient as it could be, but keeps the compiled source layout closer to the ESbuild original and eases the migration.

In the future we could put all this into separate files: runtime as a chunk, the shared style-runtime as an external dependency, and each .module.css file transpiled into a .module.css.js file that is imported.

@jsnajdr

jsnajdr commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

We should ship this regardless of the CJS fixes or not.

I applied your CJS suggestion, including the rather ugly patch that modifies the __toESM source 🙂

I'm afraid that the proper patch is to be skeptical about the namespace object coming from import * as selectors from .... There can be extra properties that are not really named selector exports. The selectors.js files should export their own object with all selectors.

@jsnajdr jsnajdr added the Require PR update Forces open PRs to update from trunk label Oct 26, 2026
@jsnajdr
jsnajdr merged commit a83e2c3 into trunk Oct 26, 2026
102 checks passed
@jsnajdr
jsnajdr deleted the try/wp-build-rolldown branch October 26, 2026 14:36
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 26, 2026
@youknowriad

Copy link
Copy Markdown
Contributor

Just imagine how long it would have taken us to ship such a migration in a pre AI world.

@jsnajdr

jsnajdr commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Just imagine how long it would have taken us to ship such a migration in a pre AI world.

It's surprising how easy it was, even in human terms 🙂

return readFile( filePath, 'utf8' );
}

compilerPromise ??= initAsyncCompiler();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With all the focus on Rolldown here, I missed that these changes also opted us into the Sass Shared Resources API ❤️ This is something I've been interested in for a while to "keep the compiler warm" while building many packages vs. one-compiler-per-package, also prototyped previously by @sirreal in #85257 .

@simison

simison commented Nov 24, 2026

Copy link
Copy Markdown
Member

Follow-up fix for translator comments at #87055

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

Labels

[Package] wp-build /packages/wp-build Require PR update Forces open PRs to update from trunk [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants