Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate sourcemaps for production build artifacts #26446

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

markerikson
Copy link
Contributor

@markerikson markerikson commented Mar 20, 2023

Summary

This PR updates the Rollup build pipeline to generate sourcemaps for production build artifacts like react-dom.production.min.js.

It requires the Rollup v3 changes that were just merged in #26442 .

Sourcemaps are currently only generated for build artifacts that are truly "production" - no sourcemaps will be generated for development, profiling, UMD, or shouldStayReadable artifacts.

The generated sourcemaps contain the bundled source contents right before that chunk was minified by Closure, and not the original source files like react-reconciler/src/*. This better reflects the actual code that is running as part of the bundle, with all the feature flags and transformations that were applied to the source files to generate that bundle. The sourcemaps do still show comments and original function names, thus improving debuggability for production usage.

Fixes #20186 .

This allows React users to actually debug a readable version of the React bundle in production scenarios. It also allows other tools like Replay to do a better job inspecting the React source when stepping through.

How did you test this change?

  • Generated numerous sourcemaps with various combinations of the React bundle selections
  • Viewed those sourcemaps in https://evanw.github.io/source-map-visualization/ and confirmed via the visualization that the generated mappings appear to be correct

I've attached a set of production files + their sourcemaps here:

react-sourcemap-examples.zip

You can drag JS+sourcemap file pairs into https://evanw.github.io/source-map-visualization/ for viewing.

Examples:

  • react.production.min.js:

image

  • react-dom.production.min.js:

image

  • use-sync-external-store/with-selector.production.min.js:

image

@react-sizebot
Copy link

react-sizebot commented Mar 21, 2023

Comparing: b798223...8291597

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.min.js +0.01% 165.61 kB 165.63 kB +0.06% 51.88 kB 51.91 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.01% 173.44 kB 173.47 kB +0.06% 54.25 kB 54.28 kB
facebook-www/ReactDOM-prod.classic.js = 569.80 kB 569.77 kB = 100.39 kB 100.38 kB
facebook-www/ReactDOM-prod.modern.js = 553.60 kB 553.57 kB = 97.54 kB 97.54 kB
facebook-react-native/scheduler/cjs/SchedulerMock-dev.js +13.22% 18.04 kB 20.42 kB +2.29% 4.36 kB 4.46 kB
facebook-www/SchedulerMock-dev.classic.js +13.07% 23.44 kB 26.51 kB +2.16% 5.48 kB 5.59 kB
facebook-www/SchedulerMock-dev.modern.js +13.07% 23.44 kB 26.51 kB +2.16% 5.48 kB 5.59 kB
facebook-www/ReactTestUtils-dev.classic.js +12.90% 48.09 kB 54.30 kB +2.12% 13.51 kB 13.79 kB
facebook-www/ReactTestUtils-dev.modern.js +12.90% 48.09 kB 54.30 kB +2.12% 13.51 kB 13.79 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
facebook-www/ReactDOMServer-dev.classic.js +12.19% 363.59 kB 407.92 kB +3.01% 80.43 kB 82.85 kB
facebook-www/ReactDOMServer-dev.modern.js +12.16% 356.16 kB 399.47 kB +2.98% 78.79 kB 81.13 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +12.15% 351.36 kB 394.06 kB +2.98% 77.63 kB 79.94 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js +12.15% 37.02 kB 41.52 kB +2.00% 10.66 kB 10.87 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js +12.12% 37.62 kB 42.18 kB +2.04% 10.83 kB 11.05 kB
facebook-www/ReactDOMTesting-dev.classic.js +12.05% 1,461.04 kB 1,637.10 kB +2.54% 315.70 kB 323.70 kB
facebook-www/ReactDOMTesting-dev.modern.js +12.03% 1,433.15 kB 1,605.53 kB +2.55% 310.13 kB 318.04 kB
facebook-react-native/react/cjs/React-dev.js +12.02% 118.87 kB 133.16 kB +2.79% 31.38 kB 32.26 kB
facebook-www/ReactDOM-dev.classic.js +12.02% 1,442.70 kB 1,616.10 kB +2.53% 311.27 kB 319.13 kB
facebook-www/ReactDOM-dev.modern.js +12.00% 1,414.81 kB 1,584.52 kB +2.55% 305.70 kB 313.50 kB
facebook-www/JSXDEVRuntime-dev.modern.js +11.99% 45.15 kB 50.56 kB +2.26% 12.82 kB 13.11 kB
facebook-www/JSXDEVRuntime-dev.classic.js +11.99% 45.15 kB 50.56 kB +2.26% 12.82 kB 13.11 kB
facebook-www/React-dev.modern.js +11.98% 125.87 kB 140.95 kB +2.87% 33.36 kB 34.32 kB
facebook-www/React-dev.classic.js +11.97% 126.97 kB 142.17 kB +2.93% 33.61 kB 34.60 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
oss-stable/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
facebook-www/ReactFreshRuntime-dev.classic.js +11.56% 20.56 kB 22.94 kB +1.76% 6.01 kB 6.12 kB
facebook-www/ReactFreshRuntime-dev.modern.js +11.56% 20.56 kB 22.94 kB +1.76% 6.01 kB 6.12 kB
facebook-www/Scheduler-dev.classic.js +11.56% 25.19 kB 28.11 kB +1.64% 6.71 kB 6.82 kB
facebook-www/Scheduler-dev.modern.js +11.56% 25.19 kB 28.11 kB +1.64% 6.71 kB 6.82 kB
oss-experimental/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
oss-stable-semver/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
oss-stable/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +11.55% 905.76 kB 1,010.34 kB +2.92% 197.55 kB 203.33 kB
facebook-www/ReactART-dev.classic.js +11.54% 916.90 kB 1,022.73 kB +2.52% 195.79 kB 200.72 kB
facebook-www/ReactART-dev.modern.js +11.53% 905.70 kB 1,010.13 kB +2.50% 193.49 kB 198.33 kB
react-native/implementations/ReactFabric-dev.fb.js +11.52% 890.10 kB 992.67 kB +2.94% 193.09 kB 198.76 kB
facebook-www/ReactTestRenderer-dev.modern.js +11.46% 805.44 kB 897.77 kB +2.49% 174.98 kB 179.34 kB
facebook-www/ReactTestRenderer-dev.classic.js +11.46% 805.44 kB 897.77 kB +2.49% 174.99 kB 179.34 kB
facebook-react-native/scheduler/cjs/Scheduler-dev.js +11.46% 17.69 kB 19.72 kB +1.76% 5.06 kB 5.15 kB
react-native/implementations/ReactNativeRenderer-dev.js +11.46% 879.18 kB 979.90 kB +2.94% 192.79 kB 198.45 kB
react-native/implementations/ReactFabric-dev.js +11.43% 863.52 kB 962.24 kB +2.94% 188.46 kB 194.00 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +11.42% 798.75 kB 889.95 kB +2.51% 174.04 kB 178.41 kB
facebook-react-native/react-is/cjs/ReactIs-dev.js +11.26% 7.29 kB 8.12 kB +1.68% 1.97 kB 2.00 kB
facebook-www/ReactIs-dev.modern.js +10.92% 7.66 kB 8.50 kB +1.52% 2.03 kB 2.06 kB
facebook-www/ReactIs-dev.classic.js +10.92% 7.67 kB 8.50 kB +1.52% 2.03 kB 2.07 kB
facebook-www/SchedulerPostTask-dev.classic.js +10.90% 7.18 kB 7.97 kB +1.48% 2.16 kB 2.19 kB
facebook-www/SchedulerPostTask-dev.modern.js +10.90% 7.18 kB 7.97 kB +1.48% 2.16 kB 2.19 kB
oss-experimental/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-stable/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-experimental/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-stable-semver/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-stable/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-experimental/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-stable/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.80% 1.34 kB 1.39 kB +2.10% 0.71 kB 0.73 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.73% 1.37 kB 1.42 kB +2.31% 0.74 kB 0.75 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.37% 1.51 kB 1.57 kB +1.76% 0.79 kB 0.81 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable-semver/react-dom/unstable_server-external-runtime.js +2.21% 2.80 kB 2.86 kB +3.58% 1.26 kB 1.30 kB
oss-stable/react-dom/unstable_server-external-runtime.js +2.21% 2.80 kB 2.86 kB +3.58% 1.26 kB 1.30 kB
oss-experimental/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-stable-semver/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-stable/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
facebook-react-native/react/cjs/JSXDEVRuntime-prod.js = 0.43 kB 0.41 kB = 0.32 kB 0.31 kB
facebook-react-native/react/cjs/JSXDEVRuntime-profiling.js = 0.43 kB 0.41 kB = 0.32 kB 0.31 kB
facebook-www/JSXDEVRuntime-prod.classic.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-prod.modern.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-profiling.classic.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-profiling.modern.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB
oss-stable/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-react-native/scheduler/cjs/SchedulerMock-dev.js +13.22% 18.04 kB 20.42 kB +2.29% 4.36 kB 4.46 kB
facebook-www/SchedulerMock-dev.classic.js +13.07% 23.44 kB 26.51 kB +2.16% 5.48 kB 5.59 kB
facebook-www/SchedulerMock-dev.modern.js +13.07% 23.44 kB 26.51 kB +2.16% 5.48 kB 5.59 kB
facebook-www/ReactTestUtils-dev.classic.js +12.90% 48.09 kB 54.30 kB +2.12% 13.51 kB 13.79 kB
facebook-www/ReactTestUtils-dev.modern.js +12.90% 48.09 kB 54.30 kB +2.12% 13.51 kB 13.79 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store.production.min.js +12.43% 0.35 kB 0.39 kB +5.65% 0.25 kB 0.26 kB
facebook-www/ReactDOMServer-dev.classic.js +12.19% 363.59 kB 407.92 kB +3.01% 80.43 kB 82.85 kB
facebook-www/ReactDOMServer-dev.modern.js +12.16% 356.16 kB 399.47 kB +2.98% 78.79 kB 81.13 kB
facebook-www/ReactDOMServerStreaming-dev.modern.js +12.15% 351.36 kB 394.06 kB +2.98% 77.63 kB 79.94 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js +12.15% 37.02 kB 41.52 kB +2.00% 10.66 kB 10.87 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js +12.12% 37.62 kB 42.18 kB +2.04% 10.83 kB 11.05 kB
facebook-www/ReactDOMTesting-dev.classic.js +12.05% 1,461.04 kB 1,637.10 kB +2.54% 315.70 kB 323.70 kB
facebook-www/ReactDOMTesting-dev.modern.js +12.03% 1,433.15 kB 1,605.53 kB +2.55% 310.13 kB 318.04 kB
facebook-react-native/react/cjs/React-dev.js +12.02% 118.87 kB 133.16 kB +2.79% 31.38 kB 32.26 kB
facebook-www/ReactDOM-dev.classic.js +12.02% 1,442.70 kB 1,616.10 kB +2.53% 311.27 kB 319.13 kB
facebook-www/ReactDOM-dev.modern.js +12.00% 1,414.81 kB 1,584.52 kB +2.55% 305.70 kB 313.50 kB
facebook-www/JSXDEVRuntime-dev.modern.js +11.99% 45.15 kB 50.56 kB +2.26% 12.82 kB 13.11 kB
facebook-www/JSXDEVRuntime-dev.classic.js +11.99% 45.15 kB 50.56 kB +2.26% 12.82 kB 13.11 kB
facebook-www/React-dev.modern.js +11.98% 125.87 kB 140.95 kB +2.87% 33.36 kB 34.32 kB
facebook-www/React-dev.classic.js +11.97% 126.97 kB 142.17 kB +2.93% 33.61 kB 34.60 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
oss-stable/react/cjs/react-jsx-dev-runtime.production.min.js +11.88% 0.35 kB 0.39 kB +5.47% 0.26 kB 0.27 kB
facebook-www/ReactFreshRuntime-dev.classic.js +11.56% 20.56 kB 22.94 kB +1.76% 6.01 kB 6.12 kB
facebook-www/ReactFreshRuntime-dev.modern.js +11.56% 20.56 kB 22.94 kB +1.76% 6.01 kB 6.12 kB
facebook-www/Scheduler-dev.classic.js +11.56% 25.19 kB 28.11 kB +1.64% 6.71 kB 6.82 kB
facebook-www/Scheduler-dev.modern.js +11.56% 25.19 kB 28.11 kB +1.64% 6.71 kB 6.82 kB
oss-experimental/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
oss-stable-semver/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
oss-stable/react-refresh/cjs/react-refresh-runtime.production.min.js +11.55% 0.36 kB 0.40 kB +4.78% 0.25 kB 0.26 kB
react-native/implementations/ReactNativeRenderer-dev.fb.js +11.55% 905.76 kB 1,010.34 kB +2.92% 197.55 kB 203.33 kB
facebook-www/ReactART-dev.classic.js +11.54% 916.90 kB 1,022.73 kB +2.52% 195.79 kB 200.72 kB
facebook-www/ReactART-dev.modern.js +11.53% 905.70 kB 1,010.13 kB +2.50% 193.49 kB 198.33 kB
react-native/implementations/ReactFabric-dev.fb.js +11.52% 890.10 kB 992.67 kB +2.94% 193.09 kB 198.76 kB
facebook-www/ReactTestRenderer-dev.modern.js +11.46% 805.44 kB 897.77 kB +2.49% 174.98 kB 179.34 kB
facebook-www/ReactTestRenderer-dev.classic.js +11.46% 805.44 kB 897.77 kB +2.49% 174.99 kB 179.34 kB
facebook-react-native/scheduler/cjs/Scheduler-dev.js +11.46% 17.69 kB 19.72 kB +1.76% 5.06 kB 5.15 kB
react-native/implementations/ReactNativeRenderer-dev.js +11.46% 879.18 kB 979.90 kB +2.94% 192.79 kB 198.45 kB
react-native/implementations/ReactFabric-dev.js +11.43% 863.52 kB 962.24 kB +2.94% 188.46 kB 194.00 kB
facebook-react-native/react-test-renderer/cjs/ReactTestRenderer-dev.js +11.42% 798.75 kB 889.95 kB +2.51% 174.04 kB 178.41 kB
facebook-react-native/react-is/cjs/ReactIs-dev.js +11.26% 7.29 kB 8.12 kB +1.68% 1.97 kB 2.00 kB
facebook-www/ReactIs-dev.modern.js +10.92% 7.66 kB 8.50 kB +1.52% 2.03 kB 2.06 kB
facebook-www/ReactIs-dev.classic.js +10.92% 7.67 kB 8.50 kB +1.52% 2.03 kB 2.07 kB
facebook-www/SchedulerPostTask-dev.classic.js +10.90% 7.18 kB 7.97 kB +1.48% 2.16 kB 2.19 kB
facebook-www/SchedulerPostTask-dev.modern.js +10.90% 7.18 kB 7.97 kB +1.48% 2.16 kB 2.19 kB
oss-experimental/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-stable/react-reconciler/cjs/react-reconciler-constants.production.min.js +10.13% 0.45 kB 0.50 kB +5.19% 0.29 kB 0.30 kB
oss-experimental/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-stable-semver/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-stable/use-subscription/cjs/use-subscription.production.min.js +8.82% 0.41 kB 0.44 kB +4.81% 0.29 kB 0.31 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.min.js +6.12% 0.90 kB 0.95 kB +3.25% 0.52 kB 0.54 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-client.production.min.js +5.88% 0.90 kB 0.96 kB +3.37% 0.51 kB 0.52 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js +5.37% 1.06 kB 1.12 kB +2.97% 0.61 kB 0.62 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +4.58% 1.05 kB 1.10 kB +2.82% 0.57 kB 0.58 kB
oss-experimental/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-stable-semver/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-stable/react/cjs/react-jsx-runtime.production.min.js +4.30% 0.86 kB 0.90 kB +2.76% 0.54 kB 0.56 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-flight-server.production.min.js +4.07% 1.30 kB 1.36 kB +2.28% 0.62 kB 0.63 kB
oss-stable-semver/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.80% 1.34 kB 1.39 kB +2.10% 0.71 kB 0.73 kB
oss-stable/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.73% 1.37 kB 1.42 kB +2.31% 0.74 kB 0.75 kB
oss-experimental/react-dom/cjs/react-dom-server-rendering-stub.production.min.js +3.37% 1.51 kB 1.57 kB +1.76% 0.79 kB 0.81 kB
oss-experimental/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-stable-semver/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-stable/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2.98% 1.11 kB 1.14 kB +2.73% 0.62 kB 0.64 kB
oss-experimental/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable/scheduler/cjs/scheduler-unstable_post_task.production.min.js +2.37% 2.02 kB 2.07 kB +2.17% 0.88 kB 0.90 kB
oss-stable-semver/react-dom/unstable_server-external-runtime.js +2.21% 2.80 kB 2.86 kB +3.58% 1.26 kB 1.30 kB
oss-stable/react-dom/unstable_server-external-runtime.js +2.21% 2.80 kB 2.86 kB +3.58% 1.26 kB 1.30 kB
oss-experimental/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-stable-semver/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-stable/jest-react/cjs/jest-react.production.min.js +2.11% 1.43 kB 1.46 kB +2.23% 0.76 kB 0.78 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +1.97% 1.37 kB 1.40 kB +1.35% 0.74 kB 0.75 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +1.97% 1.37 kB 1.40 kB +1.35% 0.74 kB 0.75 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-node-register.js +1.97% 1.37 kB 1.40 kB +1.35% 0.74 kB 0.75 kB
oss-experimental/react-dom/unstable_server-external-runtime.js +1.86% 3.33 kB 3.39 kB +3.09% 1.49 kB 1.54 kB
oss-experimental/react-suspense-test-utils/cjs/react-suspense-test-utils.js +1.81% 0.78 kB 0.79 kB +2.16% 0.51 kB 0.52 kB
oss-stable-semver/react-suspense-test-utils/cjs/react-suspense-test-utils.js +1.81% 0.78 kB 0.79 kB +2.16% 0.51 kB 0.52 kB
oss-stable/react-suspense-test-utils/cjs/react-suspense-test-utils.js +1.81% 0.78 kB 0.79 kB +2.16% 0.51 kB 0.52 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.production.min.js +1.75% 2.69 kB 2.73 kB +1.40% 1.14 kB 1.16 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.production.min.js +1.75% 2.69 kB 2.73 kB +1.40% 1.14 kB 1.16 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.production.min.js +1.75% 2.69 kB 2.73 kB +1.40% 1.14 kB 1.16 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.44% 3.19 kB 3.24 kB +1.23% 1.22 kB 1.24 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.44% 3.19 kB 3.24 kB +1.23% 1.22 kB 1.24 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +1.44% 3.19 kB 3.24 kB +1.23% 1.22 kB 1.24 kB
oss-experimental/react-cache/cjs/react-cache.production.min.js +1.43% 2.17 kB 2.20 kB +1.73% 1.10 kB 1.12 kB
oss-stable-semver/react-cache/cjs/react-cache.production.min.js +1.43% 2.17 kB 2.20 kB +1.73% 1.10 kB 1.12 kB
oss-stable/react-cache/cjs/react-cache.production.min.js +1.43% 2.17 kB 2.20 kB +1.73% 1.10 kB 1.12 kB
oss-stable-semver/react-is/cjs/react-is.production.min.js +1.24% 2.27 kB 2.29 kB +1.92% 0.78 kB 0.80 kB
oss-stable/react-is/cjs/react-is.production.min.js +1.24% 2.27 kB 2.29 kB +1.92% 0.78 kB 0.80 kB
oss-experimental/react-is/cjs/react-is.production.min.js +1.22% 2.30 kB 2.33 kB +1.89% 0.79 kB 0.81 kB
oss-experimental/scheduler/cjs/scheduler-unstable_mock.production.min.js +0.88% 4.88 kB 4.92 kB +0.86% 1.97 kB 1.99 kB
oss-stable-semver/scheduler/cjs/scheduler-unstable_mock.production.min.js +0.88% 4.88 kB 4.92 kB +0.86% 1.97 kB 1.99 kB
oss-stable/scheduler/cjs/scheduler-unstable_mock.production.min.js +0.88% 4.88 kB 4.92 kB +0.86% 1.97 kB 1.99 kB
oss-experimental/scheduler/cjs/scheduler.native.production.min.js +0.77% 4.65 kB 4.69 kB +1.23% 1.71 kB 1.73 kB
oss-stable-semver/scheduler/cjs/scheduler.native.production.min.js +0.77% 4.65 kB 4.69 kB +1.23% 1.71 kB 1.73 kB
oss-stable/scheduler/cjs/scheduler.native.production.min.js +0.77% 4.65 kB 4.69 kB +1.23% 1.71 kB 1.73 kB
oss-experimental/scheduler/cjs/scheduler.production.min.js +0.69% 4.23 kB 4.26 kB +1.07% 1.77 kB 1.79 kB
oss-stable-semver/scheduler/cjs/scheduler.production.min.js +0.69% 4.23 kB 4.26 kB +1.07% 1.77 kB 1.79 kB
oss-stable/scheduler/cjs/scheduler.production.min.js +0.69% 4.23 kB 4.26 kB +1.07% 1.77 kB 1.79 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0.60% 11.05 kB 11.11 kB +0.44% 4.28 kB 4.30 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0.60% 11.05 kB 11.11 kB +0.44% 4.28 kB 4.30 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +0.57% 10.38 kB 10.44 kB +0.47% 4.04 kB 4.06 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +0.57% 10.38 kB 10.44 kB +0.47% 4.04 kB 4.06 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.min.js +0.57% 9.68 kB 9.74 kB +0.48% 3.76 kB 3.77 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.min.js +0.57% 9.68 kB 9.74 kB +0.48% 3.76 kB 3.77 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.unbundled.production.min.js +0.53% 12.38 kB 12.44 kB +0.45% 4.65 kB 4.68 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.production.min.js +0.50% 11.70 kB 11.76 kB +0.43% 4.41 kB 4.43 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.production.min.js +0.50% 11.00 kB 11.05 kB +0.46% 4.13 kB 4.15 kB
oss-stable-semver/react/cjs/react.shared-subset.production.min.js +0.49% 7.92 kB 7.96 kB +0.55% 3.29 kB 3.31 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +0.49% 11.37 kB 11.43 kB +0.41% 4.41 kB 4.43 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +0.49% 11.37 kB 11.43 kB +0.41% 4.41 kB 4.43 kB
oss-stable/react/cjs/react.shared-subset.production.min.js +0.49% 7.94 kB 7.98 kB +0.57% 3.32 kB 3.34 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.min.js +0.49% 10.65 kB 10.70 kB +0.46% 4.11 kB 4.13 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.min.js +0.49% 10.65 kB 10.70 kB +0.46% 4.11 kB 4.13 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +0.48% 11.63 kB 11.69 kB +0.40% 4.50 kB 4.52 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +0.48% 11.63 kB 11.69 kB +0.40% 4.50 kB 4.52 kB
oss-experimental/react-refresh/cjs/react-refresh-babel.production.min.js +0.48% 8.12 kB 8.16 kB +0.58% 2.77 kB 2.79 kB
oss-stable-semver/react-refresh/cjs/react-refresh-babel.production.min.js +0.48% 8.12 kB 8.16 kB +0.58% 2.77 kB 2.79 kB
oss-stable/react-refresh/cjs/react-refresh-babel.production.min.js +0.48% 8.12 kB 8.16 kB +0.58% 2.77 kB 2.79 kB
oss-experimental/react/cjs/react.shared-subset.production.min.js +0.46% 8.46 kB 8.50 kB +0.55% 3.47 kB 3.49 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.node.production.min.js +0.44% 12.70 kB 12.76 kB +0.42% 4.79 kB 4.81 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-client.node.production.min.js +0.43% 11.98 kB 12.03 kB +0.42% 4.49 kB 4.51 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +0.43% 4.62 kB 4.64 kB +0.54% 2.03 kB 2.04 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +0.43% 4.62 kB 4.64 kB +0.54% 2.03 kB 2.04 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-plugin.js +0.43% 4.62 kB 4.64 kB +0.54% 2.03 kB 2.04 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-client.edge.production.min.js +0.43% 12.95 kB 13.00 kB +0.39% 4.88 kB 4.90 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-persistent.production.min.js +0.32% 15.64 kB 15.69 kB +0.38% 4.68 kB 4.70 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer-persistent.production.min.js +0.32% 15.64 kB 15.69 kB +0.38% 4.68 kB 4.70 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-persistent.production.min.js +0.32% 15.64 kB 15.69 kB +0.38% 4.68 kB 4.70 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js +0.32% 12.64 kB 12.68 kB +0.35% 4.84 kB 4.86 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.min.js +0.32% 12.64 kB 12.68 kB +0.35% 4.84 kB 4.86 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.min.js +0.32% 12.64 kB 12.68 kB +0.35% 4.84 kB 4.86 kB
oss-stable-semver/react/cjs/react.production.min.js +0.30% 8.30 kB 8.33 kB +0.60% 3.15 kB 3.17 kB
oss-stable/react/cjs/react.production.min.js +0.30% 8.33 kB 8.36 kB +0.63% 3.17 kB 3.19 kB
oss-experimental/react/cjs/react.production.min.js +0.27% 9.28 kB 9.30 kB +0.58% 3.45 kB 3.47 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer.production.min.js +0.25% 15.57 kB 15.61 kB +0.39% 4.67 kB 4.68 kB
oss-stable-semver/react-noop-renderer/cjs/react-noop-renderer.production.min.js +0.25% 15.57 kB 15.61 kB +0.39% 4.67 kB 4.68 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer.production.min.js +0.25% 15.57 kB 15.61 kB +0.39% 4.67 kB 4.68 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.25% 26.58 kB 26.65 kB +0.20% 9.06 kB 9.08 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.25% 26.58 kB 26.65 kB +0.20% 9.06 kB 9.08 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.24% 27.74 kB 27.81 kB +0.21% 9.34 kB 9.36 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.23% 25.32 kB 25.38 kB +0.22% 8.62 kB 8.64 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.23% 25.32 kB 25.38 kB +0.22% 8.62 kB 8.64 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.22% 26.53 kB 26.59 kB +0.21% 8.92 kB 8.94 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.22% 25.64 kB 25.70 kB +0.23% 8.72 kB 8.74 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.22% 25.64 kB 25.70 kB +0.23% 8.72 kB 8.74 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +0.22% 24.17 kB 24.22 kB +0.19% 8.39 kB 8.40 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +0.22% 24.17 kB 24.22 kB +0.19% 8.39 kB 8.40 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.21% 26.85 kB 26.91 kB +0.19% 9.02 kB 9.04 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +0.21% 27.11 kB 27.17 kB +0.20% 9.22 kB 9.24 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +0.21% 27.11 kB 27.17 kB +0.20% 9.22 kB 9.24 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +0.21% 25.33 kB 25.38 kB +0.23% 8.66 kB 8.68 kB
oss-experimental/react/umd/react.production.min.js = 13.02 kB 12.99 kB = 4.99 kB 4.99 kB
oss-experimental/react/umd/react.profiling.min.js = 13.01 kB 12.99 kB = 5.00 kB 4.99 kB
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js = 12.78 kB 12.75 kB = 4.91 kB 4.90 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.production.min.js = 12.78 kB 12.75 kB = 4.91 kB 4.90 kB
oss-stable/react-dom/umd/react-dom-test-utils.production.min.js = 12.78 kB 12.75 kB = 4.91 kB 4.90 kB
oss-stable/react/umd/react.production.min.js = 12.13 kB 12.10 kB = 4.72 kB 4.71 kB
oss-stable/react/umd/react.profiling.min.js = 12.13 kB 12.10 kB = 4.72 kB 4.71 kB
oss-stable-semver/react/umd/react.production.min.js = 12.10 kB 12.08 kB = 4.69 kB 4.69 kB
oss-stable-semver/react/umd/react.profiling.min.js = 12.10 kB 12.07 kB = 4.69 kB 4.69 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js = 11.96 kB 11.94 kB = 4.52 kB 4.51 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js = 10.65 kB 10.62 kB = 4.14 kB 4.13 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-client.browser.production.min.js = 10.65 kB 10.62 kB = 4.14 kB 4.13 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.min.js = 7.13 kB 7.10 kB = 2.66 kB 2.65 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.min.js = 7.13 kB 7.10 kB = 2.66 kB 2.65 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js = 7.13 kB 7.10 kB = 2.66 kB 2.65 kB
facebook-www/ReactIs-prod.classic.js = 5.36 kB 5.34 kB = 1.31 kB 1.30 kB
facebook-www/ReactIs-prod.modern.js = 5.36 kB 5.34 kB = 1.31 kB 1.30 kB
facebook-react-native/react-is/cjs/ReactIs-prod.js = 4.85 kB 4.83 kB = 1.20 kB 1.19 kB
facebook-react-native/react-is/cjs/ReactIs-profiling.js = 4.85 kB 4.83 kB = 1.20 kB 1.19 kB
facebook-www/SchedulerPostTask-prod.classic.js = 4.31 kB 4.29 kB = 1.19 kB 1.18 kB
facebook-www/SchedulerPostTask-prod.modern.js = 4.31 kB 4.29 kB = 1.19 kB 1.18 kB
facebook-www/SchedulerPostTask-profiling.classic.js = 4.31 kB 4.29 kB = 1.19 kB 1.18 kB
facebook-www/SchedulerPostTask-profiling.modern.js = 4.31 kB 4.29 kB = 1.19 kB 1.18 kB
oss-experimental/scheduler/umd/scheduler-unstable_mock.production.min.js = 4.95 kB 4.93 kB = 2.07 kB 2.06 kB
oss-stable-semver/scheduler/umd/scheduler-unstable_mock.production.min.js = 4.95 kB 4.93 kB = 2.07 kB 2.06 kB
oss-stable/scheduler/umd/scheduler-unstable_mock.production.min.js = 4.95 kB 4.93 kB = 2.07 kB 2.06 kB
facebook-www/React-profiling.classic.js = 21.32 kB 21.13 kB = 5.34 kB 5.29 kB
facebook-www/React-profiling.modern.js = 21.03 kB 20.84 kB = 5.26 kB 5.21 kB
facebook-react-native/react/cjs/React-profiling.js = 20.76 kB 20.57 kB = 5.23 kB 5.18 kB
oss-experimental/react-is/umd/react-is.production.min.js = 2.39 kB 2.36 kB = 0.89 kB 0.88 kB
oss-experimental/react-reconciler/cjs/react-reconciler.profiling.min.js = 124.10 kB 122.68 kB +0.42% 37.33 kB 37.48 kB
oss-stable-semver/react-is/umd/react-is.production.min.js = 2.35 kB 2.32 kB = 0.88 kB 0.87 kB
oss-stable/react-is/umd/react-is.production.min.js = 2.35 kB 2.32 kB = 0.88 kB 0.87 kB
oss-stable/react-reconciler/cjs/react-reconciler.profiling.min.js = 119.57 kB 118.17 kB +0.45% 35.95 kB 36.11 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.profiling.min.js = 119.54 kB 118.15 kB +0.45% 35.93 kB 36.09 kB
oss-experimental/react-reconciler/cjs/react-reconciler.production.min.js = 115.08 kB 113.72 kB +0.20% 35.10 kB 35.17 kB
oss-experimental/react-client/cjs/react-client-flight.production.min.js = 10.70 kB 10.57 kB = 4.05 kB 4.03 kB
oss-stable/react-reconciler/cjs/react-reconciler.production.min.js = 110.55 kB 109.22 kB +0.38% 33.72 kB 33.85 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler.production.min.js = 110.53 kB 109.20 kB +0.38% 33.69 kB 33.82 kB
facebook-www/Scheduler-profiling.classic.js = 15.40 kB 15.21 kB = 3.62 kB 3.58 kB
facebook-www/Scheduler-profiling.modern.js = 15.40 kB 15.21 kB = 3.62 kB 3.58 kB
facebook-react-native/react/cjs/JSXRuntime-prod.js = 1.49 kB 1.47 kB = 0.73 kB 0.72 kB
facebook-react-native/react/cjs/JSXRuntime-profiling.js = 1.49 kB 1.47 kB = 0.73 kB 0.72 kB
oss-stable-semver/react-client/cjs/react-client-flight.production.min.js = 9.51 kB 9.38 kB = 3.73 kB 3.70 kB
oss-stable/react-client/cjs/react-client-flight.production.min.js = 9.51 kB 9.38 kB = 3.73 kB 3.70 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js = 17.53 kB 17.26 kB = 6.19 kB 6.17 kB
oss-experimental/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.73 kB 1.71 kB = 0.91 kB 0.91 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js = 16.40 kB 16.13 kB = 5.91 kB 5.90 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js = 16.40 kB 16.13 kB = 5.91 kB 5.90 kB
facebook-react-native/scheduler/cjs/Scheduler-profiling.js = 11.20 kB 11.01 kB = 2.80 kB 2.75 kB
oss-stable/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.58 kB 1.55 kB = 0.86 kB 0.86 kB
oss-stable-semver/react-dom/umd/react-dom-server-rendering-stub.production.min.js = 1.55 kB 1.52 kB = 0.84 kB 0.83 kB
oss-experimental/react-server/cjs/react-server.production.min.js = 26.27 kB 25.78 kB +0.09% 8.91 kB 8.92 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js = 25.52 kB 25.03 kB +0.17% 8.67 kB 8.68 kB
oss-stable/react-server/cjs/react-server.production.min.js = 25.52 kB 25.03 kB +0.17% 8.67 kB 8.68 kB
oss-experimental/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
oss-stable-semver/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
oss-stable/react/cjs/react-jsx-runtime.profiling.min.js = 0.86 kB 0.84 kB = 0.54 kB 0.53 kB
facebook-react-native/react/cjs/JSXDEVRuntime-prod.js = 0.43 kB 0.41 kB = 0.32 kB 0.31 kB
facebook-react-native/react/cjs/JSXDEVRuntime-profiling.js = 0.43 kB 0.41 kB = 0.32 kB 0.31 kB
facebook-www/JSXDEVRuntime-prod.classic.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-prod.modern.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-profiling.classic.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
facebook-www/JSXDEVRuntime-profiling.modern.js = 0.43 kB 0.41 kB = 0.30 kB 0.30 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB
oss-stable/react/cjs/react-jsx-dev-runtime.profiling.min.js = 0.34 kB 0.32 kB = 0.26 kB 0.25 kB

Generated by 🚫 dangerJS against 8291597

@markerikson markerikson force-pushed the feature/build-prod-sourcemaps branch 3 times, most recently from c55dbf9 to ca37e8c Compare March 21, 2023 22:32
@markerikson
Copy link
Contributor Author

And this PR is now green!

It still needs an actual review, and also to rebased after the Rollup v3 PR is merged, but the sourcemaps work and CI is passing.

@markerikson
Copy link
Contributor Author

markerikson commented Mar 24, 2023

The Rollup v3 upgrade in #26442 was merged. Just rebased this against main to pick up those changes.

Should be ready for review now!

/cc @gaearon

@0xdevalias
Copy link
Contributor

Note that this PR will supercede and invalidate past work on this such as:

@0xdevalias 0xdevalias mentioned this pull request Mar 27, 2023
@justingrant
Copy link
Contributor

Will this PR also help with sourcemaps in debug builds? In the past, debugging into React source code with the VS Code debugger has been a challenge, I assume because sourcemaps were not aligned with the actual sources.

cc @jasonwilliams

@markerikson
Copy link
Contributor Author

@justingrant : no , I'm not trying to generate sourcemaps for dev build artifacts, because those should already be readable. Do you have an example where debugging a React dev build isn't working well?

@justingrant
Copy link
Contributor

@markerikson - my experience is pretty dated from a few years ago, and was largely focused on create-react-app which handled sourcemap creation in its webpack config. Things might have improved since then. But I do remember that debugging into debug React builds seldom/never aligned with the source. If you believe it's working now, then I'm inclined to trust your judgment and assume that the problems I was seeing were caused by CRA not React's debug sourcemaps.

@jasonwilliams was also looking into this so he may have more info.

@markerikson
Copy link
Contributor Author

@gaearon you mentioned on Twitter that "the license stuff is complicated". Any specific concerns there, or other feedback on the PR?

@gaearon
Copy link
Collaborator

gaearon commented Mar 28, 2023

Yes. I don't fully understand what's going on there. One option is that I need to dive into this. Another is that I can pose a constraint from my perspective. This constraint is: can we reduce any manual string manipulation in this PR? Ideally there would be none. What would the approach look like if we did not have any string manipulation code? If it's due to license headers, can we inject them at a different stage (e.g. earlier), or inject them in a way that automatically adjusts the sourcemaps? What is the sequence of problems that make this code necessary?

@markerikson
Copy link
Contributor Author

There's a couple pieces here.

Rollup's own sourcemap handling normally produces a sourcemap where the "original" code is "the individual original source files", such as packages/react-reconciler/src/ReactFiberWorkLoop.js. While that's better than no sourcemap at all, that's not really very helpful. The React source code appears to undergo major transformations during the bundling process - various dev/prod checks, code being rearranged based on feature flags, etc.

Because of that, what we we really want is to have a sourcemap where the "original" code is actually "the bundle contents right before Closure minified it" - in other words, the code that actually executed in the user's app.

In order to make this happen, I skipped Rollup's sourcemap handling, and had Closure write a sourcemap for its minification step to disk. That contains 95% of the actual sourcemap content that we need.

However, there's one more step in the Rollup pipeline after Closure. wrappers.js adds a combination of license header text and module format wrappers around the bundled source, based on the desired output bundle (Node dev/prod, UMD, FB internal, etc).

Because of that, the sourcemap from the Closure step is no longer accurate. If a particular mapping instruction pointed to a specific line segment in the output, the addition of the license text + wrapper before that in the final output throws off all the mappings.

In order to align things correctly, we have to generate a sourcemap for the "possibly minified bundle -> bundle with license wrapper" step, and merge that with the "pre-minified bundle -> post-minified bundle" step.

The best option I could come up with for doing that was to take the output of the license step, split it using the code to get the pieces that were added before and after, and re-run that step with a sourcemap-aware tool (the same magic-string library that Rollup uses internally) in order to generate the extra sourcemap.

It's maybe possible that we could move the license step before the Closure step, but I suspect that Closure would immediately strip off the license headers because those are comments. Don't know if there's somehow a Closure option that would allow us to preserve the headers. Also not sure what effect that would have on the rest of the module wrapping code that wrappers.js adds.

I also played with using magic-string inside of wrappers.js and sorta got it working, but that actually required more overall effort than this approach did. I had to start modifying all of the license wrapper template strings in wrappers.js, and wanted to go for a set of changes that was more minimal and self-contained.

With this approach, the bulk of the sourcemap work is in the one custom Rollup plugin there after the license plugin, and almost all the code changes are inside getRollupOptions other than the tweak to have plugins/closure.js write a sourcemap to disk.

@0xdevalias
Copy link
Contributor

I also played with using magic-string inside of wrappers.js and sorta got it working, but that actually required more overall effort than this approach did. I had to start modifying all of the license wrapper template strings in wrappers.js, and wanted to go for a set of changes that was more minimal and self-contained.

@markerikson @gaearon @jasonwilliams For historical purposes, this was also an approach I explored back in July 2022 when I was looking into fixing the things required to get sourcemap support added.

From a quick search, this seems to be (at least one of the) places where I was looking at the license wrapper code, and proposed using magic-string, etc:

It includes a bit of a code exploration, some exploration of related libraries, and some proposals/diffs of how it could be used within the existing wrapper code in a 'minimally different'/low touch way, that should be simple to maintain, etc.

scripts/rollup/build.js Outdated Show resolved Hide resolved
scripts/rollup/build.js Outdated Show resolved Hide resolved
@markerikson
Copy link
Contributor Author

Huh. I just tried reordering the Rollup plugins so that the license step does go before Closure and it skips the string manipulation step...

and I think it's working the same way?

I did a very brief search last night and think I found an indication that Closure might preserve comments with @license blocks.

I need to do some more investigation here, but this seems promising at first glance.

@markerikson markerikson force-pushed the feature/build-prod-sourcemaps branch from fc846c2 to e485811 Compare March 29, 2023 20:00
@markerikson
Copy link
Contributor Author

markerikson commented Mar 29, 2023

Adding the license + wrappers before the Closure step seems to work.

I did have to add an extra @preserve attribute to the RN bundle wrappers in order to get it to keep those license blocks, but that appears to be getting kept now.

That removes the need for the string manipulation and the extra sourcemap merging step.

The sourcemaps themselves still appear to be fully accurate.

Some of the RN dev bundles have increased in size, but that appears to be due to them getting formatted by Prettier more so than they were previously (function call args getting split across multiple lines, etc). No actual content changes that I can see.

@markerikson markerikson force-pushed the feature/build-prod-sourcemaps branch from e485811 to b1c8802 Compare March 29, 2023 20:10
@markerikson
Copy link
Contributor Author

@gaearon I think this looks pretty good! Please look it over when you get a chance and let me know if you have further feedback!


// Any other packages that should specifically _not_ have sourcemaps
const sourcemapPackageExcludes = [
// Having `//#sourceMappingUrl` in this file breaks `ReactDevToolsHooksIntegration-test.js`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why? Can we fix the test to be more resilient instead?

Copy link
Contributor Author

@markerikson markerikson Mar 31, 2023

Choose a reason for hiding this comment

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

Not sure. It took me close to an hour just to figure out that having a sourcemap URL added to that bundle file was even the reason why that test was failing, and I have no idea why that was the case. Seemed to be something about imports or source parsing, maybe.

Per the comment, that file really doesn't need to have sourcemaps anyway, so it's reasonable to exclude it.

Copy link
Collaborator

@gaearon gaearon Mar 31, 2023

Choose a reason for hiding this comment

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

I appreciate the time spent on this, but we generally try to understand each problem exhaustively before attempting a fix. In this case, it's important to understand why the test fails. Especially since the test has something to do with DevTools integration (which relies on parsing stacks), and might be flagging a real problem.

Even if it's not a real problem, imagine someone adding another package with similar logic, and then being confused why this logic doesn't fail tests when it's inside react-debug-tools, but does elsewhere. Then they would have to spend an hour only to find that react-debug-tools is somehow exceptional.

We do need to get to the bottom of the real cause.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll dig into this further and see if I can understand what's going on.

Copy link
Collaborator

Choose a reason for hiding this comment

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

isStateEditable is calculated here so you might want to check if the primitive value is affected by the presence of sourcemaps. Maybe something gets borked in the stack parsing logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did some further poking at this. I think this is due to the react-debug-tools logic combined with the actual test setup in the first place.

The stack trace string, prior to being parsed, is:

Error: 
    at Object.apply (/home/acemarke/projects/react/scripts/jest/setupTests.js:219:29)
    at Proxy.Error (/home/acemarke/projects/react/build/oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js:122:21)
    at Object.useReducer (/home/acemarke/projects/react/build/oss-stable/react/cjs/react.production.min.js:959:21)
    at MyComponent (/home/acemarke/projects/react/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js:101:13)
    at renderFunction (/home/acemarke/projects/react/build/oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js:652:5)
    at Object.inspectHooks [as inspectHooksOfFiber] (/home/acemarke/projects/react/build/oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js:763:12)
    at Object.<anonymous> (/home/acemarke/projects/react/packages/react-debug-tools/src/__tests__/ReactDevToolsHooksIntegration-test.js:118:32)

Note that Proxy.Error is already in the stack trace string.

react-debug-tools.production.min.js:122 is:

        useInsertionEffect: function(a) {
          C();
          x.push({
            primitive: "InsertionEffect",
            stackError: Error(),
            value: a
          })
        },

Note the line stackError: Error(), and .stackError is what's getting passed to the error-stack-parser library.

If you look at scripts/jest/setupTests.js, it has this logic that overwrites global.Error with a proxy:

    const ErrorProxy = new Proxy(OriginalError, {
      apply(target, thisArg, argumentsList) {
        const error = Reflect.apply(target, thisArg, argumentsList);
        error.message = decodeErrorMessage(error.message);
        return proxyErrorInstance(error);
      },
      construct(target, argumentsList, newTarget) {
        const error = Reflect.construct(target, argumentsList, newTarget);
        error.message = decodeErrorMessage(error.message);
        return proxyErrorInstance(error);
      },
      get(target, key, receiver) {
        if (key === 'captureStackTrace') {
          return captureStackTrace;
        }
        return Reflect.get(target, key, receiver);
      },
    });
    ErrorProxy.OriginalError = OriginalError;
    global.Error = ErrorProxy;

So, I think the inclusion of the sourcemap for react-debug-tools.production.min.js is causing Node to alter the stack trace related to that global.Error = ErrorProxy, which ends up breaking the parsing later.

Copy link
Collaborator

@gaearon gaearon Apr 20, 2023

Choose a reason for hiding this comment

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

Sorry, I still don't quite understand. Where is the mistake? Which part is wrong here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaearon : there is no "mistake" per se.

The test setup code works as intended. The error stack parsing code works as intended.

But per my last comment, having a sourcemap for react-debug-tools.production.min.js causes Node to have different stack trace contents for the thrown error, which then causes the hook name parsing logic to fail to match what it expected to see.

We know this test worked fine when there was no sourcemap. It's an internal package, and there's no reason to have a sourcemap for this bundle.

So, we should skip it and keep the behavior the same as it was.

Copy link
Contributor

Choose a reason for hiding this comment

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

We know this test worked fine when there was no sourcemap. It's an internal package, and there's no reason to have a sourcemap for this bundle.

Can confirm that this package is a part of React DevTools' backend, but for historical reasons (which I don't know) it is present as a separate package in this monorepo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I did just actually happen to talk to Brian today about the fact that gets used as part of the RDT backend to parse hook names.

That said, while it's technically published ( https://www.npmjs.com/package/react-debug-tools ) , it doesn't look like it's even been published at all since the first release 5 years ago, and it seems like the only references are inside of the RDT internals. So, still no reason that I can see to justify having a sourcemap generated for that package, especially given the test situation.

@hoxyq
Copy link
Contributor

hoxyq commented Nov 7, 2023

We've decided to keep the manual exclusion of react-debug-tools from having sourcemaps - #27612 (comment). I will remove it later by moving react-debug-tools to React DevTools' backend files.

This PR should be ready to go, I will double-check everything today and merge it.

@markerikson
Copy link
Contributor Author

AWESOME! Thank you so much for helping push this through! Please let me know if there's any last-minute tweaks needed and I can get those done today.

@hoxyq hoxyq merged commit 2c8a139 into facebook:main Nov 7, 2023
36 checks passed
@bvaughn
Copy link
Contributor

bvaughn commented Nov 7, 2023

🥳

@hoxyq
Copy link
Contributor

hoxyq commented Nov 7, 2023

Thanks again for working on this @markerikson!

@markerikson
Copy link
Contributor Author

Awesome! And thank you for helping push this across the finish line!

github-actions bot pushed a commit that referenced this pull request Nov 7, 2023
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

This PR updates the Rollup build pipeline to generate sourcemaps for
production build artifacts like `react-dom.production.min.js`.

It requires the Rollup v3 changes that were just merged in #26442 .

Sourcemaps are currently _only_ generated for build artifacts that are
_truly_ "production" - no sourcemaps will be generated for development,
profiling, UMD, or `shouldStayReadable` artifacts.

The generated sourcemaps contain the bundled source contents right
before that chunk was minified by Closure, and _not_ the original source
files like `react-reconciler/src/*`. This better reflects the actual
code that is running as part of the bundle, with all the feature flags
and transformations that were applied to the source files to generate
that bundle. The sourcemaps _do_ still show comments and original
function names, thus improving debuggability for production usage.

Fixes #20186 .

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->

This allows React users to actually debug a readable version of the
React bundle in production scenarios. It also allows other tools like
[Replay](https://replay.io) to do a better job inspecting the React
source when stepping through.

## How did you test this change?

- Generated numerous sourcemaps with various combinations of the React
bundle selections
- Viewed those sourcemaps in
https://evanw.github.io/source-map-visualization/ and confirmed via the
visualization that the generated mappings appear to be correct

I've attached a set of production files + their sourcemaps here:

[react-sourcemap-examples.zip](https://github.com/facebook/react/files/11023466/react-sourcemap-examples.zip)

You can drag JS+sourcemap file pairs into
https://evanw.github.io/source-map-visualization/ for viewing.

Examples:

- `react.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478247-e5cbdee0-83fd-4a19-bcf1-09961d3c7da4.png)

- `react-dom.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478433-b5ccbf0f-8f68-42fe-9db9-9ecb97770d46.png)

- `use-sync-external-store/with-selector.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478565-bc74699d-db14-4c39-9e2d-b775f8755561.png)

<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->

DiffTrain build for [2c8a139](2c8a139)
@jasikpark
Copy link

wahooo 🥳

kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Nov 8, 2023
acdlite added a commit to acdlite/react that referenced this pull request Apr 11, 2024
In facebook#26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of
the optimizations that are in the final build, like dead
code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds
for Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser.
This is when the source maps are generated.
acdlite added a commit to acdlite/react that referenced this pull request Apr 11, 2024
In facebook#26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of
the optimizations that are in the final build, like dead
code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds
for Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser.
This is when the source maps are generated.
acdlite added a commit to acdlite/react that referenced this pull request Apr 11, 2024
In facebook#26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of
the optimizations that are in the final build, like dead
code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds
for Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser.
This is when the source maps are generated.
acdlite added a commit to acdlite/react that referenced this pull request Apr 11, 2024
In facebook#26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of
the optimizations that are in the final build, like dead
code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds
for Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser.
This is when the source maps are generated.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

This PR updates the Rollup build pipeline to generate sourcemaps for
production build artifacts like `react-dom.production.min.js`.
 
It requires the Rollup v3 changes that were just merged in facebook#26442 .

Sourcemaps are currently _only_ generated for build artifacts that are
_truly_ "production" - no sourcemaps will be generated for development,
profiling, UMD, or `shouldStayReadable` artifacts.

The generated sourcemaps contain the bundled source contents right
before that chunk was minified by Closure, and _not_ the original source
files like `react-reconciler/src/*`. This better reflects the actual
code that is running as part of the bundle, with all the feature flags
and transformations that were applied to the source files to generate
that bundle. The sourcemaps _do_ still show comments and original
function names, thus improving debuggability for production usage.

Fixes facebook#20186 .




<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->

This allows React users to actually debug a readable version of the
React bundle in production scenarios. It also allows other tools like
[Replay](https://replay.io) to do a better job inspecting the React
source when stepping through.

## How did you test this change?

- Generated numerous sourcemaps with various combinations of the React
bundle selections
- Viewed those sourcemaps in
https://evanw.github.io/source-map-visualization/ and confirmed via the
visualization that the generated mappings appear to be correct

I've attached a set of production files + their sourcemaps here:


[react-sourcemap-examples.zip](https://github.com/facebook/react/files/11023466/react-sourcemap-examples.zip)

You can drag JS+sourcemap file pairs into
https://evanw.github.io/source-map-visualization/ for viewing.

Examples:

- `react.production.min.js`:


![image](https://user-images.githubusercontent.com/1128784/226478247-e5cbdee0-83fd-4a19-bcf1-09961d3c7da4.png)

- `react-dom.production.min.js`:


![image](https://user-images.githubusercontent.com/1128784/226478433-b5ccbf0f-8f68-42fe-9db9-9ecb97770d46.png)

- `use-sync-external-store/with-selector.production.min.js`:


![image](https://user-images.githubusercontent.com/1128784/226478565-bc74699d-db14-4c39-9e2d-b775f8755561.png)


<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

This PR updates the Rollup build pipeline to generate sourcemaps for
production build artifacts like `react-dom.production.min.js`.

It requires the Rollup v3 changes that were just merged in #26442 .

Sourcemaps are currently _only_ generated for build artifacts that are
_truly_ "production" - no sourcemaps will be generated for development,
profiling, UMD, or `shouldStayReadable` artifacts.

The generated sourcemaps contain the bundled source contents right
before that chunk was minified by Closure, and _not_ the original source
files like `react-reconciler/src/*`. This better reflects the actual
code that is running as part of the bundle, with all the feature flags
and transformations that were applied to the source files to generate
that bundle. The sourcemaps _do_ still show comments and original
function names, thus improving debuggability for production usage.

Fixes #20186 .

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->

This allows React users to actually debug a readable version of the
React bundle in production scenarios. It also allows other tools like
[Replay](https://replay.io) to do a better job inspecting the React
source when stepping through.

## How did you test this change?

- Generated numerous sourcemaps with various combinations of the React
bundle selections
- Viewed those sourcemaps in
https://evanw.github.io/source-map-visualization/ and confirmed via the
visualization that the generated mappings appear to be correct

I've attached a set of production files + their sourcemaps here:

[react-sourcemap-examples.zip](https://github.com/facebook/react/files/11023466/react-sourcemap-examples.zip)

You can drag JS+sourcemap file pairs into
https://evanw.github.io/source-map-visualization/ for viewing.

Examples:

- `react.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478247-e5cbdee0-83fd-4a19-bcf1-09961d3c7da4.png)

- `react-dom.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478433-b5ccbf0f-8f68-42fe-9db9-9ecb97770d46.png)

- `use-sync-external-store/with-selector.production.min.js`:

![image](https://user-images.githubusercontent.com/1128784/226478565-bc74699d-db14-4c39-9e2d-b775f8755561.png)

<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->

DiffTrain build for commit 2c8a139.
acdlite added a commit to acdlite/react that referenced this pull request Apr 19, 2024
In facebook#26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of
the optimizations that are in the final build, like dead
code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds
for Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser.
This is when the source maps are generated.
acdlite added a commit that referenced this pull request Apr 19, 2024
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.
github-actions bot pushed a commit that referenced this pull request Apr 19, 2024
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.

DiffTrain build for commit 0e0b693.
github-actions bot pushed a commit that referenced this pull request Apr 19, 2024
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.

DiffTrain build for [0e0b693](0e0b693)
bigfootjon pushed a commit that referenced this pull request Apr 25, 2024
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.

DiffTrain build for commit 0e0b693.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distribute source maps for easier debugging in Chrome's Performance tab