-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cjs client components tree-shaking (#64558)
## What Determine if the client module is a CJS file and `default` export is imported, then we include the whole module instead of using webpack magic comments to only extract `default` export. ## Why Unlike ESM, The `default` export of CJS module is not just `.default` property, we need to include `__esModule` mark along with `default` export to make it function properly with React client module proxy Fixes #64518 Closes NEXT-3119
- Loading branch information
Showing
6 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/production/app-dir/client-components-tree-shaking/app/cjs-dep/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import CjsClientDefault from 'cjs-client-module' | ||
|
||
export default function Page() { | ||
return <CjsClientDefault /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...production/app-dir/client-components-tree-shaking/node_modules/cjs-client-module/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...uction/app-dir/client-components-tree-shaking/node_modules/cjs-client-module/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters