GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Follow-up improvements to error code extraction infra by acdlite · Pull Request #22516 · react/react

Conversation

@acdlite

@acdlite acdlite commented Oct 6, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

This is a stack of improvements to our error code infra that culminates with a replacement for the extract-errors script.

First I updated the error transform to output a FIXME comment in the final bundle if 1) the bundle is configured to have its error minified 2) it encounters an error that doesn't have a matching code. Then a post-build CI job will detect these by grepping the build artifacts. (This already exists; we used it for invariant messages.) This is more reliable than linting the source modules because there's not a 1-1 correspondence between the source and the build output. For example, some modules appear in multiple builds. (Linting the source is still useful, though, because it can prompt you during local development before you run the build script or open the PR.)

Next I also added the expected error message format to the FIXME comments. This enables us to scrape the missing messages from the build artifacts.

/* FIXME (minify-errors-in-prod): Unminified error message in production build! */
/* <expected-error-format>"Error message with no corresponding error code"</expected-error-format> */

Again, this is more reliable than scraping from source because it only matches errors that actually appear in a build whose errors are meant to be minified.

Then I updated the extract-errors script to implement this strategy. Another thing that's nice about this compared to the old extract-errors script is that you can run it without also running the build script at the same time. You could even download artifacts with the yarn download-build command and scrape the messages from those.

Finally I updated CI to use extract-errors to check for unminified messages instead just grep. The effect is nearly the same except extract-errors has nicer output that you can copy paste directly into codes.json. Running it in CI also forces us to maintain that script, which I had honestly forgotten about because I didn't use to run it that often. (Old one was too slow so I would instead manually update codes.json).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@acdlite
acdlite requested a review from sebmarkbage October 6, 2021 13:07
@facebook-github-bot facebook-github-bot added the React Core Team Opened by a member of the React Core Team label Oct 6, 2021
@sizebot

sizebot commented Oct 6, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 9c8161b...b2e38a9

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 = 130.19 kB 130.19 kB = 41.42 kB 41.42 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 135.16 kB 135.16 kB = 42.95 kB 42.95 kB
facebook-www/ReactDOM-prod.classic.js = 419.90 kB 419.90 kB = 77.34 kB 77.34 kB
facebook-www/ReactDOM-prod.modern.js = 408.48 kB 408.48 kB = 75.59 kB 75.59 kB
facebook-www/ReactDOMForked-prod.classic.js = 419.90 kB 419.90 kB = 77.34 kB 77.34 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.80% 31.98 kB 35.12 kB +9.63% 10.68 kB 11.71 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.66% 31.85 kB 34.92 kB +9.63% 10.62 kB 11.64 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.66% 31.85 kB 34.92 kB +9.63% 10.62 kB 11.64 kB
oss-experimental/react-server/cjs/react-server.production.min.js +9.33% 17.26 kB 18.87 kB +10.45% 5.94 kB 6.56 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +9.27% 32.28 kB 35.28 kB +8.78% 10.92 kB 11.87 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +9.13% 32.15 kB 35.08 kB +8.64% 10.86 kB 11.80 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +9.13% 32.15 kB 35.08 kB +8.64% 10.86 kB 11.80 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +9.06% 17.13 kB 18.69 kB +10.36% 5.90 kB 6.51 kB
oss-stable/react-server/cjs/react-server.production.min.js +9.06% 17.13 kB 18.69 kB +10.36% 5.90 kB 6.51 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.production.min.js +7.40% 79.94 kB 85.85 kB +7.05% 24.95 kB 26.71 kB
oss-stable/react-test-renderer/umd/react-test-renderer.production.min.js +7.40% 79.94 kB 85.85 kB +7.05% 24.95 kB 26.71 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.production.min.js +7.39% 79.75 kB 85.65 kB +7.13% 24.64 kB 26.40 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.production.min.js +7.39% 79.75 kB 85.65 kB +7.13% 24.64 kB 26.40 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.production.min.js +7.00% 84.28 kB 90.18 kB +6.82% 25.86 kB 27.62 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.production.min.js +6.99% 84.48 kB 90.38 kB +6.26% 26.39 kB 28.05 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-stable/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-experimental/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-stable-semver/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-stable/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-experimental/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB
oss-stable-semver/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB
oss-stable/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.node.production.min.server.js +11.74% 6.92 kB 7.74 kB +7.02% 2.87 kB 3.07 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-writer.browser.production.min.server.js +11.20% 6.79 kB 7.55 kB +6.65% 2.84 kB 3.03 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-writer.browser.production.min.server.js +10.85% 7.01 kB 7.77 kB +6.62% 2.93 kB 3.13 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +10.82% 6.99 kB 7.75 kB +6.34% 2.92 kB 3.10 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.80% 31.98 kB 35.12 kB +9.63% 10.68 kB 11.71 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.66% 31.85 kB 34.92 kB +9.63% 10.62 kB 11.64 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.production.min.js +9.66% 31.85 kB 34.92 kB +9.63% 10.62 kB 11.64 kB
oss-experimental/react-server/cjs/react-server.production.min.js +9.33% 17.26 kB 18.87 kB +10.45% 5.94 kB 6.56 kB
oss-experimental/react-dom/cjs/react-dom-server.node.production.min.js +9.27% 32.28 kB 35.28 kB +8.78% 10.92 kB 11.87 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.production.min.js +9.13% 32.15 kB 35.08 kB +8.64% 10.86 kB 11.80 kB
oss-stable/react-dom/cjs/react-dom-server.node.production.min.js +9.13% 32.15 kB 35.08 kB +8.64% 10.86 kB 11.80 kB
oss-stable-semver/react-server/cjs/react-server.production.min.js +9.06% 17.13 kB 18.69 kB +10.36% 5.90 kB 6.51 kB
oss-stable/react-server/cjs/react-server.production.min.js +9.06% 17.13 kB 18.69 kB +10.36% 5.90 kB 6.51 kB
oss-stable-semver/react-test-renderer/umd/react-test-renderer.production.min.js +7.40% 79.94 kB 85.85 kB +7.05% 24.95 kB 26.71 kB
oss-stable/react-test-renderer/umd/react-test-renderer.production.min.js +7.40% 79.94 kB 85.85 kB +7.05% 24.95 kB 26.71 kB
oss-stable-semver/react-test-renderer/cjs/react-test-renderer.production.min.js +7.39% 79.75 kB 85.65 kB +7.13% 24.64 kB 26.40 kB
oss-stable/react-test-renderer/cjs/react-test-renderer.production.min.js +7.39% 79.75 kB 85.65 kB +7.13% 24.64 kB 26.40 kB
oss-experimental/react-test-renderer/cjs/react-test-renderer.production.min.js +7.00% 84.28 kB 90.18 kB +6.82% 25.86 kB 27.62 kB
oss-experimental/react-test-renderer/umd/react-test-renderer.production.min.js +6.99% 84.48 kB 90.38 kB +6.26% 26.39 kB 28.05 kB
oss-experimental/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-stable-semver/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-stable/react-dom/cjs/react-dom-test-utils.production.min.js +6.96% 11.81 kB 12.63 kB +4.34% 4.60 kB 4.80 kB
oss-experimental/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-stable-semver/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-stable/react-dom/umd/react-dom-test-utils.production.min.js +6.90% 11.92 kB 12.74 kB +4.41% 4.67 kB 4.88 kB
oss-stable-semver/react/cjs/react.production.min.js +1.61% 7.21 kB 7.32 kB +0.92% 2.83 kB 2.86 kB
oss-stable/react/cjs/react.production.min.js +1.61% 7.21 kB 7.32 kB +0.92% 2.83 kB 2.86 kB
oss-experimental/react/cjs/react.production.min.js +1.47% 7.90 kB 8.02 kB +0.90% 2.99 kB 3.02 kB
oss-stable-semver/react/umd/react.profiling.min.js +0.99% 11.26 kB 11.37 kB +0.31% 4.49 kB 4.50 kB
oss-stable/react/umd/react.profiling.min.js +0.99% 11.26 kB 11.37 kB +0.31% 4.49 kB 4.50 kB
oss-stable-semver/react/umd/react.production.min.js +0.99% 11.26 kB 11.38 kB +0.22% 4.49 kB 4.50 kB
oss-stable/react/umd/react.production.min.js +0.99% 11.26 kB 11.38 kB +0.22% 4.49 kB 4.50 kB
oss-experimental/react/umd/react.profiling.min.js +0.94% 11.89 kB 12.00 kB +0.52% 4.64 kB 4.67 kB
oss-experimental/react/umd/react.production.min.js +0.94% 11.89 kB 12.00 kB +0.43% 4.64 kB 4.66 kB
facebook-www/ReactDOMServer-dev.classic.js = 159.32 kB 158.53 kB = 40.52 kB 40.20 kB
oss-experimental/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-stable-semver/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-stable/react-pg/cjs/react-pg.node.production.min.server.js = 1.33 kB 1.30 kB = 0.76 kB 0.66 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js = 6.89 kB 6.59 kB = 2.61 kB 2.43 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack.production.min.js = 4.25 kB 4.02 kB = 1.92 kB 1.79 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack.production.min.js = 4.05 kB 3.82 kB = 1.83 kB 1.70 kB
oss-experimental/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB
oss-stable-semver/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB
oss-stable/react-fetch/cjs/react-fetch.node.production.min.js = 2.31 kB 2.01 kB = 1.09 kB 0.91 kB

Generated by 🚫 dangerJS against b2e38a9

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@acdlite
acdlite force-pushed the lint-build-unminified-errors branch from a81d95c to 1d592e8 Compare October 6, 2021 13:18
@facebook-github-bot facebook-github-bot added the CLA Signed label Oct 6, 2021
@acdlite
acdlite force-pushed the lint-build-unminified-errors branch from 1d592e8 to 5b85a39 Compare October 6, 2021 13:22
@acdlite

acdlite commented Oct 6, 2021

Copy link
Copy Markdown
Collaborator Author

It's detecting some unminified errors in development builds. I forgot we run the transform script on development builds, too, because that's what used to transform the invariant calls. Don't need to anymore, though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@acdlite

acdlite commented Oct 6, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator Author

Hmm I think I might change it to break the build instead of outputting a FIXME. I forgot the minifier strips comments from the build. Though the downside would be that you can't run the build script unless all the errors are already added to the map.

Will try to think of something else.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@acdlite
acdlite marked this pull request as draft October 6, 2021 13:50
@acdlite
acdlite force-pushed the lint-build-unminified-errors branch 3 times, most recently from b948f41 to f36a740 Compare October 6, 2021 14:16
acdlite
acdlite commented Oct 6, 2021
View reviewed changes
Comment thread scripts/rollup/build.js Outdated

@acdlite acdlite Oct 6, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I hoisted this up because I noticed that the noMinify option was only being applied to the FB builds. So previously the minifyWithProdErrorCodes that I recently added was being ignored.

The effect of this PR is to stop minifying some error messages that were previously were minifying, like ones that run on the server.

The ones we actually care about, that run in the browser, are unaffected. But we now have this toggle to control precisely which builds to extract errors from.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@acdlite acdlite changed the title Output FIXME during build for unminified errors Follow-up improvements to error code extraction infra Oct 6, 2021
@acdlite
acdlite force-pushed the lint-build-unminified-errors branch 15 times, most recently from a9b8540 to 143973e Compare October 7, 2021 13:31
@acdlite
acdlite marked this pull request as ready for review October 7, 2021 14:00
@acdlite acdlite mentioned this pull request Oct 7, 2021
Extract errors from Error() and new Error() instead of invariant() #22514
Closed
@acdlite
acdlite requested a review from rickhanlonii October 7, 2021 21:18
crypt096
crypt096 approved these changes Oct 12, 2021
View reviewed changes
acdlite added 7 commits October 31, 2021 12:27
@acdlite
Output FIXME during build for unminified errors
cc24142
The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.
@acdlite
Don't run error transform in development
5a290b1
We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.
@acdlite
Add ! to FIXME comment so Closure doesn't strip it
9e61bbb
Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.
@acdlite
Alternate extract-errors that scrapes artifacts
7bb6b69
The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.
@acdlite
Disable error minification in more bundles
bf07c91
Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.
@acdlite
Run extract-errors script in CI
24feb63
The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.
@acdlite
Replace old extract-errors script with new one
b2e38a9
Deletes the old extract-errors in favor of extract-errors2
@acdlite
acdlite force-pushed the lint-build-unminified-errors branch from 143973e to b2e38a9 Compare October 31, 2021 16:30
@acdlite
acdlite merged commit 7034408 into react:main Oct 31, 2021
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Nov 2, 2021
Andrei Shikov @facebook-github-bot
React Native sync for revisions afcb9cd...3fcd81d
e161598
Summary:
This sync includes the following changes:
- **[5cccacd](react/react@5cccacd13 )**: Upgrade useId to alpha channel ([#22674](react/react#22674)) //<Andrew Clark>//
- **[75f3dde](react/react@75f3ddebf )**: Remove experimental useOpaqueIdentifier API ([#22672](react/react#22672)) //<Andrew Clark>//
- **[8c4a05b](react/react@8c4a05b8f )**: Remove flow pragma comment from module registration start/stop templates ([#22670](react/react#22670)) //<Brian Vaughn>//
- **[ebf9ae8](react/react@ebf9ae857 )**: useId ([#22644](react/react#22644)) //<Andrew Clark>//
- **[a0d991f](react/react@a0d991fe6 )**: Re-land #22292 (remove uMS from open source build) ([#22664](react/react#22664)) //<Andrew Clark>//
- **[6bce035](react/react@6bce0355c )**: Upgrade useSyncExternalStore to alpha channel ([#22662](react/react#22662)) //<Andrew Clark>//
- **[7034408](react/react@7034408ff )**: Follow-up improvements to error code extraction infra ([#22516](react/react#22516)) //<Andrew Clark>//
- **[90e5d36](react/react@90e5d3638 )**: chore: fix comment typo ([#22615](react/react#22615)) //<btea>//
- **[3c4c1c4](react/react@3c4c1c470 )**: Remove warning for dangling passive effects ([#22609](react/react#22609)) //<Andrew Clark>//
- **[d5b6b4b](react/react@d5b6b4b86 )**: Expand act warning to cover all APIs that might schedule React work ([#22607](react/react#22607)) //<Andrew Clark>//
- **[fa9bea0](react/react@fa9bea0c4 )**: Initial implementation of cache cleanup ([#22510](react/react#22510)) //<Joseph Savona>//
- **[0e8a5af](react/react@0e8a5aff3 )**: Scheduling Profiler: Add marks for component effects (mount and unmount) ([#22578](react/react#22578)) //<Brian Vaughn>//
- **[4ba2057](react/react@4ba20579d )**: Scheduling Profiler: De-emphasize React internal frames ([#22588](react/react#22588)) //<Brian Vaughn>//
- **[cdb8a1d](react/react@cdb8a1d19 )**: [Fizz] Add option to inject bootstrapping script tags after the shell is injected ([#22594](react/react#22594)) //<Sebastian Markbåge>//
- **[34e4c97](react/react@34e4c9756 )**: Clear extra nodes if there's a hydration mismatch within a suspense boundary  ([#22592](react/react#22592)) //<Sebastian Markbåge>//
- **[02f4115](react/react@02f411578 )**: Upgrade useInsertionEffect to stable ([#22589](react/react#22589)) //<Andrew Clark>//
- **[2af4a79](react/react@2af4a7933 )**: Hydrate using SuspenseComponent as the parent ([#22582](react/react#22582)) //<Sebastian Markbåge>//
- **[b1acff0](react/react@b1acff0cc )**: Enable cache in test renderer ([#22580](react/react#22580)) //<Joseph Savona>//
- **[996da67](react/react@996da67b2 )**: Replace global `jest` heuristic with `IS_REACT_ACT_ENVIRONMENT` ([#22562](react/react#22562)) //<Andrew Clark>//
- **[163e81c](react/react@163e81c1f )**: Support disabling spurious act warnings with a global environment flag ([#22561](react/react#22561)) //<Andrew Clark>//
- **[23b7dfe](react/react@23b7dfeff )**: Enable scheduling profiler for RN FB profiling builds ([#22566](react/react#22566)) //<Brian Vaughn>//
- **[61455a2](react/react@61455a25b )**: Enable experimental Cache API in www TestRenderer ([#22554](react/react#22554)) //<Joseph Savona>//
- **[7142d11](react/react@7142d110b )**: Bugfix: Nested useOpaqueIdentifier references ([#22553](react/react#22553)) //<Andrew Clark>//
- **[1e247ff](react/react@1e247ff89 )**: Enabled scheduling profiler marks for React Native FB target ([#22544](react/react#22544)) //<Brian Vaughn>//
- **[c16b005](react/react@c16b005f2 )**: Update test and stack frame code to support newer V8 stack formats ([#22477](react/react#22477)) //<Brian Vaughn>//
- **[55d7500](react/react@55d75005b )**: duplicate value in variable ([#22390](react/react#22390)) //<BIKI DAS>//

Changelog:
[General][Changed] - React Native sync for revisions afcb9cd...3fcd81d

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32065987

fbshipit-source-id: ef2d402835c981aab68ca40a894c66c1630864e9
KamranAsif pushed a commit to KamranAsif/react that referenced this pull request Nov 4, 2021
@acdlite @KamranAsif
Follow-up improvements to error code extraction infra (react#22516)
7c158a6
* Output FIXME during build for unminified errors

The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.

* Don't run error transform in development

We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.

* Add ! to FIXME comment so Closure doesn't strip it

Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.

* Alternate extract-errors that scrapes artifacts

The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.

* Disable error minification in more bundles

Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.

* Run extract-errors script in CI

The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.

* Replace old extract-errors script with new one

Deletes the old extract-errors in favor of extract-errors2
@elas7 elas7 mentioned this pull request Nov 6, 2021
Delete unused Circle CI scripts. #22710
Merged
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Nov 15, 2021
Andrei Shikov @facebook-github-bot
React Native sync for revisions afcb9cd...c0c71a8
55663ec
Summary:
This sync includes the following changes:
- **[c0c71a8](react/react@c0c71a868 )**: Re-enable useMutableSource in internal RN ([#22750](react/react#22750)) //<Ricky>//
- **[cb11155](react/react@cb11155c8 )**: Add runtime type checks around module boundary code ([#22748](react/react#22748)) //<Brian Vaughn>//
- **[a04f13d](react/react@a04f13d29 )**: [email protected] //<Dan Abramov>//
- **[ff9897d](react/react@ff9897d23 )**: [React Refresh] support typescript namespace syntax ([#22621](react/react#22621)) //<irinakk>//
- **[0ddd69d](react/react@0ddd69d12 )**: Throw on hydration mismatch and force client rendering if boundary hasn't suspended within concurrent root ([#22629](react/react#22629)) //<salazarm>//
- **[c3f34e4](react/react@c3f34e4be )**: [email protected] //<Dan Abramov>//
- **[827021c](react/react@827021c4e )**: Changelog for [email protected] //<Dan Abramov>//
- **[8ca3f56](react/react@8ca3f567b )**: Fix module-boundary wrappers ([#22688](react/react#22688)) //<Brian Vaughn>//
- **[1bf6deb](react/react@1bf6deb86 )**: Renamed packages/react-devtools-scheduling-profiler to packages/react-devtools-timeline ([#22691](react/react#22691)) //<Brian Vaughn>//
- **[51c558a](react/react@51c558aeb )**: Rename (some) "scheduling profiler" references to "timeline" ([#22690](react/react#22690)) //<Brian Vaughn>//
- **[00ced1e](react/react@00ced1e2b )**: Fix useId in strict mode ([#22681](react/react#22681)) //<Andrew Clark>//
- **[5cccacd](react/react@5cccacd13 )**: Upgrade useId to alpha channel ([#22674](react/react#22674)) //<Andrew Clark>//
- **[75f3dde](react/react@75f3ddebf )**: Remove experimental useOpaqueIdentifier API ([#22672](react/react#22672)) //<Andrew Clark>//
- **[8c4a05b](react/react@8c4a05b8f )**: Remove flow pragma comment from module registration start/stop templates ([#22670](react/react#22670)) //<Brian Vaughn>//
- **[ebf9ae8](react/react@ebf9ae857 )**: useId ([#22644](react/react#22644)) //<Andrew Clark>//
- **[a0d991f](react/react@a0d991fe6 )**: Re-land #22292 (remove uMS from open source build) ([#22664](react/react#22664)) //<Andrew Clark>//
- **[6bce035](react/react@6bce0355c )**: Upgrade useSyncExternalStore to alpha channel ([#22662](react/react#22662)) //<Andrew Clark>//
- **[7034408](react/react@7034408ff )**: Follow-up improvements to error code extraction infra ([#22516](react/react#22516)) //<Andrew Clark>//
- **[90e5d36](react/react@90e5d3638 )**: chore: fix comment typo ([#22615](react/react#22615)) //<btea>//
- **[3c4c1c4](react/react@3c4c1c470 )**: Remove warning for dangling passive effects ([#22609](react/react#22609)) //<Andrew Clark>//
- **[d5b6b4b](react/react@d5b6b4b86 )**: Expand act warning to cover all APIs that might schedule React work ([#22607](react/react#22607)) //<Andrew Clark>//
- **[fa9bea0](react/react@fa9bea0c4 )**: Initial implementation of cache cleanup ([#22510](react/react#22510)) //<Joseph Savona>//
- **[0e8a5af](react/react@0e8a5aff3 )**: Scheduling Profiler: Add marks for component effects (mount and unmount) ([#22578](react/react#22578)) //<Brian Vaughn>//
- **[4ba2057](react/react@4ba20579d )**: Scheduling Profiler: De-emphasize React internal frames ([#22588](react/react#22588)) //<Brian Vaughn>//
- **[cdb8a1d](react/react@cdb8a1d19 )**: [Fizz] Add option to inject bootstrapping script tags after the shell is injected ([#22594](react/react#22594)) //<Sebastian Markbåge>//
- **[34e4c97](react/react@34e4c9756 )**: Clear extra nodes if there's a hydration mismatch within a suspense boundary  ([#22592](react/react#22592)) //<Sebastian Markbåge>//
- **[02f4115](react/react@02f411578 )**: Upgrade useInsertionEffect to stable ([#22589](react/react#22589)) //<Andrew Clark>//
- **[2af4a79](react/react@2af4a7933 )**: Hydrate using SuspenseComponent as the parent ([#22582](react/react#22582)) //<Sebastian Markbåge>//
- **[b1acff0](react/react@b1acff0cc )**: Enable cache in test renderer ([#22580](react/react#22580)) //<Joseph Savona>//
- **[996da67](react/react@996da67b2 )**: Replace global `jest` heuristic with `IS_REACT_ACT_ENVIRONMENT` ([#22562](react/react#22562)) //<Andrew Clark>//
- **[163e81c](react/react@163e81c1f )**: Support disabling spurious act warnings with a global environment flag ([#22561](react/react#22561)) //<Andrew Clark>//
- **[23b7dfe](react/react@23b7dfeff )**: Enable scheduling profiler for RN FB profiling builds ([#22566](react/react#22566)) //<Brian Vaughn>//
- **[61455a2](react/react@61455a25b )**: Enable experimental Cache API in www TestRenderer ([#22554](react/react#22554)) //<Joseph Savona>//
- **[7142d11](react/react@7142d110b )**: Bugfix: Nested useOpaqueIdentifier references ([#22553](react/react#22553)) //<Andrew Clark>//
- **[1e247ff](react/react@1e247ff89 )**: Enabled scheduling profiler marks for React Native FB target ([#22544](react/react#22544)) //<Brian Vaughn>//
- **[c16b005](react/react@c16b005f2 )**: Update test and stack frame code to support newer V8 stack formats ([#22477](react/react#22477)) //<Brian Vaughn>//
- **[55d7500](react/react@55d75005b )**: duplicate value in variable ([#22390](react/react#22390)) //<BIKI DAS>//

Changelog:
[General][Changed] - React Native sync for revisions afcb9cd...c0c71a8

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32395873

fbshipit-source-id: 3afd158f167b1eedcc244e29aba1a2c502d3c9d9
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
@acdlite @zhengjitf
Follow-up improvements to error code extraction infra (react#22516)
3d067a2
* Output FIXME during build for unminified errors

The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.

* Don't run error transform in development

We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.

* Add ! to FIXME comment so Closure doesn't strip it

Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.

* Alternate extract-errors that scrapes artifacts

The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.

* Disable error minification in more bundles

Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.

* Run extract-errors script in CI

The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.

* Replace old extract-errors script with new one

Deletes the old extract-errors in favor of extract-errors2
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@acdlite
Follow-up improvements to error code extraction infra (react#22516)
d911585
* Output FIXME during build for unminified errors

The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.

* Don't run error transform in development

We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.

* Add ! to FIXME comment so Closure doesn't strip it

Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.

* Alternate extract-errors that scrapes artifacts

The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.

* Disable error minification in more bundles

Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.

* Run extract-errors script in CI

The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.

* Replace old extract-errors script with new one

Deletes the old extract-errors in favor of extract-errors2
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@acdlite
Follow-up improvements to error code extraction infra (react#22516)
206cc7f
* Output FIXME during build for unminified errors

The invariant Babel transform used to output a FIXME comment if it
could not find a matching error code. This could happen if there were
a configuration mistake that caused an unminified message to
slip through.

Linting the compiled bundles is the most reliable way to do it because
there's not a one-to-one mapping between source modules and bundles. For
example, the same source module may appear in multiple bundles, some
which are minified and others which aren't.

This updates the transform to output the same messages for Error calls.

The source lint rule is still useful for catching mistakes during
development, to prompt you to update the error codes map before pushing
the PR to CI.

* Don't run error transform in development

We used to run the error transform in both production and development,
because in development it was used to convert `invariant` calls into
throw statements.

Now that don't use `invariant` anymore, we only have to run the
transform for production builds.

* Add ! to FIXME comment so Closure doesn't strip it

Don't love this solution because Closure could change this heuristic,
or we could switch to a differnt compiler that doesn't support it. But
it works.

Could add a bundle that contains an unminified error solely for the
purpose of testing it, but that seems like overkill.

* Alternate extract-errors that scrapes artifacts

The build script outputs a special FIXME comment when it fails to minify
an error message. CI will detect these comments and fail the workflow.

The comments also include the expected error message. So I added an
alternate extract-errors that scrapes unminified messages from the
build artifacts and updates `codes.json`.

This is nice because it works on partial builds. And you can also run it
after the fact, instead of needing build all over again.

* Disable error minification in more bundles

Not worth it because the number of errors does not outweight the size
of the formatProdErrorMessage runtime.

* Run extract-errors script in CI

The lint_build job already checks for unminified errors, but the output
isn't super helpful.

Instead I've added a new job that runs the extract-errors script and
fails the build if `codes.json` changes. It also outputs the expected
diff so you can easily see which messages were missing from the map.

* Replace old extract-errors script with new one

Deletes the old extract-errors in favor of extract-errors2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sebmarkbage sebmarkbage Awaiting requested review from sebmarkbage
@rickhanlonii rickhanlonii Awaiting requested review from rickhanlonii
1 more reviewer
@crypt096 crypt096 crypt096 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@acdlite @sizebot @crypt096 @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.