[Flight] Do not redefine debugInfo on JSX elements
After updating to 19.2 in Parcel, I'm seeing "Cannot redefine property _debugInfo" errors, which appear to be caused by #34524. Looks like _debugInfo is already defined as null in some cases (e.g. JSX elements), and marked as non-configurable/writable. Then moveDebugInfoFromChunkToInnerValue tries to re-define it.
This happens when you directly export a JSX element as a client reference. In that case the React Element object is frozen, so the _debugInfo property cannot be written to.
"use client";
export default <Foo />
I added a test for this and made a small workaround that simply skips setting _debugInfo if it is not writable, but idk if this is the correct fix.
Comparing: 408b38ef7304faf022d2a37110c57efce12c6bad...c776f1c7481f4d3d8c9a91508515b15c4d501cf3
Critical size changes
Includes critical production bundles, as well as any change greater than 2%:
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| oss-stable/react-dom/cjs/react-dom.production.js | = | 6.68 kB | 6.68 kB | = | 1.83 kB | 1.83 kB |
| oss-stable/react-dom/cjs/react-dom-client.production.js | = | 605.41 kB | 605.41 kB | = | 107.22 kB | 107.22 kB |
| oss-experimental/react-dom/cjs/react-dom.production.js | = | 6.69 kB | 6.69 kB | +0.05% | 1.83 kB | 1.83 kB |
| oss-experimental/react-dom/cjs/react-dom-client.production.js | = | 664.38 kB | 664.38 kB | = | 117.09 kB | 117.09 kB |
| facebook-www/ReactDOM-prod.classic.js | = | 688.25 kB | 688.25 kB | = | 121.13 kB | 121.13 kB |
| facebook-www/ReactDOM-prod.modern.js | = | 678.67 kB | 678.67 kB | = | 119.49 kB | 119.49 kB |
Significant size changes
Includes any change greater than 0.2%:
Expand to show
| Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip |
|---|---|---|---|---|---|---|
| oss-stable-semver/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js | +0.30% | 93.66 kB | 93.95 kB | +0.51% | 19.20 kB | 19.29 kB |
| oss-stable/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js | +0.30% | 93.66 kB | 93.95 kB | +0.51% | 19.20 kB | 19.29 kB |
| oss-experimental/react-server-dom-esm/esm/react-server-dom-esm-client.browser.production.js | +0.30% | 94.45 kB | 94.73 kB | +0.50% | 19.31 kB | 19.41 kB |
Generated by :no_entry_sign: dangerJS against c776f1c7481f4d3d8c9a91508515b15c4d501cf3
@unstubbable @sebmarkbage hey, happy to fix the conflicts here but did either of you have any thoughts on this? We're blocked on upgrading in some projects that use this pattern of exporting a JSX element.