2af6b63dd1
### 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` |
||
---|---|---|
.. | ||
analysis | ||
babel | ||
jest | ||
output | ||
polyfills | ||
swc | ||
webpack | ||
compiler.ts | ||
cssnano-simple.js | ||
entries.ts | ||
generate-build-id.ts | ||
index.ts | ||
is-writeable.ts | ||
load-jsconfig.ts | ||
spinner.ts | ||
utils.ts | ||
webpack-config.ts | ||
worker.ts | ||
write-build-id.ts |