Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix esm property def in flight loader (#66286)
### What Remove creating client proxy for each ESM export, instead for ESM we create a CJS module proxy for itself and access the property with export name as the actual export. ### Why `proxy` is the module proxy that we treat the module as a client boundary. For ESM, we access the property of the module proxy directly for each export. This is bit hacky that treating using a CJS like module proxy for ESM's exports, but this will avoid creating nested proxies for each export. It will be improved in the future. Notice that for `next/dynamic`, if you're doing a dynamic import of client component in server component, and trying to access the named export directly, it will error. Instead you need to align the dynamic import resolved value wrapping with a `default:` property (e.g. `{ default: resolved }`) like what `React.lazy` accepted. Revert #57301 Fixes #66212 x-ref: [slack](https://vercel.slack.com/archives/C04DUD7EB1B/p1716897764858829)
- Loading branch information