-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix react-refresh for transpiled packages (#60563)
### What We're applying react-refresh to browser layer and inject ESM or CJS helper based on file type. Some package from `trasnpilePackages` might contain CJS browser bundle. And injecting ESM helper breaks them. Actually they don't need to have fast refresh ability since they're in `node_modules`. ### How Skip react-refresh for transpiled packages as they're in node_modules and won't change. Fixes #56487 Closes NEXT-2061
- Loading branch information
Showing
10 changed files
with
26 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
'use client' | ||
|
||
import { instance } from 'cjs-modern-syntax' | ||
import { packageName } from 'transpile-cjs-lib' | ||
|
||
export default function Page() { | ||
return ( | ||
<> | ||
<div id="private-prop">{instance.getProp()}</div> | ||
<div id="transpile-cjs-lib">{packageName}</div> | ||
</> | ||
) | ||
} |
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
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/app-external/node_modules_bak/transpile-cjs-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
exports.packageName = 'transpile-cjs-lib' |
5 changes: 5 additions & 0 deletions
5
test/e2e/app-dir/app-external/node_modules_bak/transpile-cjs-lib/package.json
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 @@ | ||
{ | ||
"name": "transpile-cjs-lib", | ||
"type": "commonjs", | ||
"exports": "./index.js" | ||
} |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
test/e2e/app-dir/app-external/node_modules_bak/transpile-ts-lib/package.json
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,4 @@ | ||
{ | ||
"name": "transpile-ts-lib", | ||
"main": "index.ts" | ||
} |
4 changes: 0 additions & 4 deletions
4
test/e2e/app-dir/app-external/node_modules_bak/untranspiled-module/package.json
This file was deleted.
Oops, something went wrong.