Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Sep 16, 2025

The source of workers was inlined since workers were introduced in #21902.

Inlining the worker meant it was not subject to minification. The hook name parser worker can be minified down to 839kB (from ≈1.6MB) and file fetcher to 218kB (from ≈400kB). This allows us to not create an async chunk for the worker loader. It's just 2kB that avoids a waterfall from loading the module and then loading the worker. Now we load the worker directly.

I only did this for the extensions since we have full control of the public path and where assets are placed. Can't guarantee the same for the other bundles especially because testing those is non-trivial.

Test plan

Hook name parsing works in https://rf3fky.csb.app/ for Edge, Chrome and Firefox

@meta-cla meta-cla bot added the CLA Signed label Sep 16, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Sep 16, 2025
@eps1lon eps1lon force-pushed the sebbie/09-16-_devtools_don_t_inline_parse_hook_name_worker branch from 3e3ed1d to a08bca1 Compare September 17, 2025 09:48
@react-sizebot
Copy link

react-sizebot commented Sep 17, 2025

Comparing: 27b4076...74a26e0

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 534.32 kB 534.32 kB = 94.32 kB 94.32 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 663.64 kB 663.64 kB = 117.01 kB 117.01 kB
facebook-www/ReactDOM-prod.classic.js = 687.59 kB 687.59 kB = 121.04 kB 121.04 kB
facebook-www/ReactDOM-prod.modern.js = 678.02 kB 678.02 kB = 119.39 kB 119.39 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 74a26e0

@eps1lon eps1lon force-pushed the sebbie/09-16-_devtools_don_t_inline_parse_hook_name_worker branch from a08bca1 to ec61196 Compare September 17, 2025 09:57
@eps1lon eps1lon changed the title [DevTools] Don't inline parse Hook name worker [DevTools] Don't inline workers Sep 17, 2025
@eps1lon eps1lon force-pushed the sebbie/09-16-_devtools_don_t_inline_parse_hook_name_worker branch 2 times, most recently from cdf65b6 to eac0b53 Compare September 17, 2025 11:20
@eps1lon eps1lon changed the title [DevTools] Don't inline workers [DevTools] Don't inline workers for extensions Sep 17, 2025
@eps1lon eps1lon force-pushed the sebbie/09-16-_devtools_don_t_inline_parse_hook_name_worker branch from a62fabe to 74a26e0 Compare September 17, 2025 13:48
Comment on lines +46 to +47
// workers in this bundle, we can sync require the module since it's just a thin
// wrapper around calling the worker.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

2kB to be specific

Comment on lines +834 to +839
- name: Archive Playwright report
uses: actions/upload-artifact@v4
with:
name: devtools-playwright-artifacts
path: tmp/playwright-artifacts
if-no-files-found: warn
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will help debugging CI failures even though that wasn't necessary here. The issue was reproducible locally.

@eps1lon eps1lon requested a review from hoxyq September 17, 2025 14:15
@eps1lon eps1lon marked this pull request as ready for review September 17, 2025 14:16
@eps1lon eps1lon merged commit 128abcf into facebook:main Sep 17, 2025
247 checks passed
@eps1lon eps1lon deleted the sebbie/09-16-_devtools_don_t_inline_parse_hook_name_worker branch September 17, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants