next.js
81defe2b - Fix: resolve mixed re-exports module as cjs (#64681)

Commit
1 year ago
Fix: resolve mixed re-exports module as cjs (#64681) ### Why If you have a client entry that mixing `default` re-export and `*` re-export, atm we cannot statically analyze all the exports from this the boundary, unless we can apply barrel file optimization for every import which could slow down speed. ```js // index.js 'use client' export * from './client' export { default } from './client' ``` Before that happen we high recommend you don't mixing that and try to add the client directive to the leaf level client module. We're not able to determine what the identifiers are imported from the wildcard import path. This would work if we resolved the actual file but currently we can't. ### What When we found the mixing client entry module like that, we treat it as a CJS client module and include all the bundle in client like before what we have the client components import optimization. Ideally we could warn users don't apply the client directive to these kinda of barrel file, and only apply them to where we needed. Fixes #64518 Closes NEXT-3119
Author
Parents
Loading