rsnext/test/e2e/app-dir/rsc-basic/app
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
..
css-in-js Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
css-modules Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
edge/dynamic Client directive (#40415) 2022-09-18 00:00:16 +00:00
escaping-rsc Client directive (#40415) 2022-09-18 00:00:16 +00:00
external-imports Client directive (#40415) 2022-09-18 00:00:16 +00:00
global-styles-rsc Client directive (#40415) 2022-09-18 00:00:16 +00:00
multi Client directive (#40415) 2022-09-18 00:00:16 +00:00
native-module Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
next-api Add handling for static generation in app (#40561) 2022-09-19 18:05:28 +00:00
partial-hydration Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
react-server Add optoutServerComponentsBundle option (#40770) 2022-09-24 18:47:42 +00:00
root Add handling for static generation in app (#40561) 2022-09-19 18:05:28 +00:00
shared Should resolve esm external module imports on server (#40865) 2022-09-26 15:46:01 -07:00
streaming-rsc Client directive (#40415) 2022-09-18 00:00:16 +00:00
various-exports Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00
layout.js Add handling for static generation in app (#40561) 2022-09-19 18:05:28 +00:00
page.js Should resolve esm external module imports on server (#40865) 2022-09-26 15:46:01 -07:00
root-style-registry.js Remove internal client next api detection (#40646) 2022-09-18 09:36:10 +00:00