rsnext/test/e2e/app-dir/rsc-basic
Jiachi Liu 2af6b63dd1
Should resolve esm external module imports on server (#40865)
### Issue

When import an esm package in client component, and use it in server
component page, it will fail to SSR but render successfully on client.
It's because the import to esm package will make the client chunk become
an **async module** since esm module will be treated as **async**.

```
page (serve component) -> local module (client) -> external dependency (esm)
```

Then in react SSR layer, it need the module type information of that
chunk, async or not for react so that react could unwrap the async
module from `Promise` properly when SSR.

### Solution

We need to mark the client entries which are effected by async/esm
modules that becoming **async** as `async: true` in SSR manifest.

Since flight manifest plugin is only running against client compiler,
which doesn't have those module information from server compiler. So we
collect the async modules from the **server** compiler **client** layer
from flight entry client plugin, then leverage the collection to detect
if a module is async in flight manifest plugin for react.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-09-26 15:46:01 -07:00
..
app Should resolve esm external module imports on server (#40865) 2022-09-26 15:46:01 -07:00
components Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
node_modules_bak Should resolve esm external module imports on server (#40865) 2022-09-26 15:46:01 -07:00
public Migrate rsc integration tests to e2e tests (#38460) 2022-07-09 14:02:30 +02:00
next.config.js Add optoutServerComponentsBundle option (#40770) 2022-09-24 18:47:42 +00:00