ed3ee38108
### What Exclude precompiled react packages from browser layer loaders coverage. ### Why Since we're transpiling all the browser layer code now after #59569, then SWC will also compile react. But when it compiles `react.production.min.js` it gives me with the code and ESM helper inserted ```js import { _ as _type_of } from "@swc/helpers/_/_type_of"; // This is not correct var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Sym bol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.f ``` This makes bundler think it's a ESM package but actually it's CJS, which converts the module into `{ default: .., __esModule }` instead of the original react module. When you're using `React.useEffect` or other API through namespace import (`import * as React from 'react'`), this will break the module exports check in bundling as the property doesn't directly attached to the module now. This PR disabled the transform for precompiled react packages now and will see the deeper issue in next-swc side later. Fixes #60890 Fixes #61185 Closes NEXT-2362 |
||
---|---|---|
.. | ||
action/client | ||
app-routes | ||
async-storage | ||
cjs | ||
client-dep | ||
css | ||
esm | ||
esm-client-ref | ||
external-imports | ||
font | ||
mixed | ||
optout/action | ||
react-server | ||
shared-esm-dep | ||
wildcard | ||
layout.js |