-
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 barrel optimizer conflicts with client entry module (#56020)
The barrel optimization loader creates a virtual module to re-export from the original file, which causes the situation that now there are 2 modules with the same resource but only one of them is the actual code. When the code contains `"use client"`, the Flight plugin has to collect its `buildInfo` and generate the manifest and client entry module. However, we currently deduplicate module by resource in the traversal logic to avoid unnecessary loops. To make it work together with the virtual barrel module, we'll need to prefix the resource path to make it different from the original module. Closes #54967. Closes #55609. Closes #55566.
- Loading branch information
Showing
7 changed files
with
42 additions
and
3 deletions.
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
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
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
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
9 changes: 9 additions & 0 deletions
9
test/development/basic/barrel-optimization/app/client/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,9 @@ | ||
import { Client } from 'my-lib' | ||
|
||
export default function Page() { | ||
return ( | ||
<h1> | ||
<Client /> | ||
</h1> | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
test/development/basic/barrel-optimization/node_modules_bak/my-lib/client.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 @@ | ||
'use client' | ||
|
||
export function Client() { | ||
return 'this is a client component' | ||
} |
1 change: 1 addition & 0 deletions
1
test/development/basic/barrel-optimization/node_modules_bak/my-lib/index.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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './a' | ||
export * from './client' |