rsnext/test/e2e/app-dir/app-external/app
Jiachi Liu ed3ee38108
Fix attempted import error for react (#61791)
### 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
2024-02-08 00:57:43 +01:00
..
action/client Transpile all code on app browser layer (#59569) 2023-12-20 17:08:07 +01:00
app-routes Fix next/server api alias for ESM pkg (#61721) 2024-02-06 16:59:24 +00:00
async-storage build: fix externals resolution when importing from next/dist (#55269) 2023-09-12 10:26:34 +00:00
cjs Fix next/server api alias for ESM pkg (#61721) 2024-02-06 16:59:24 +00:00
client-dep Fix package resolution issue in app dir (#43349) 2022-11-25 01:19:21 +00:00
css Eagerly bundle external ESM dependencies for pages (#42741) 2022-11-10 18:11:38 +01:00
esm Fix attempted import error for react (#61791) 2024-02-08 00:57:43 +01:00
esm-client-ref Fix client boundary defined in a module (#46171) 2023-02-21 15:20:45 +00:00
external-imports Fix react-refresh for transpiled packages (#60563) 2024-01-12 21:44:41 +01:00
font Eagerly bundle external ESM dependencies for pages (#42741) 2022-11-10 18:11:38 +01:00
mixed Fix mixed module swc compilation for app router (#58967) 2023-12-01 15:23:43 +01:00
optout/action Fix server output bundling packages module resolving (#59369) 2023-12-07 18:11:11 +01:00
react-server Prefer module over main on main fields for app router server compiler (#56960) 2023-10-19 16:06:47 +00:00
shared-esm-dep Eagerly bundle external ESM dependencies for pages (#42741) 2022-11-10 18:11:38 +01:00
wildcard Fix conflict when re-exporting multiple Client References (#49468) 2023-05-16 12:35:12 +02:00
layout.js Eagerly bundle external ESM dependencies for pages (#42741) 2022-11-10 18:11:38 +01:00