Skip to content

Commit

Permalink
Fix react-dom aliases for edge RSC (vercel#63619)
Browse files Browse the repository at this point in the history
Follow up to vercel#63588, we missed edge there

Closes NEXT-2905
  • Loading branch information
lubieowoce authored Mar 25, 2024
1 parent 81c6b56 commit f509de9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,13 @@ async fn rsc_aliases(
if runtime == NextRuntime::Edge {
if matches!(ty, ServerContextType::AppRSC { .. }) {
alias["react"] = format!("next/dist/compiled/react{react_channel}/react.react-server");
alias["react-dom"] =
format!("next/dist/compiled/react-dom{react_channel}/react-dom.react-server");
} else {
// x-ref: https://github.com/facebook/react/pull/25436
alias["react-dom"] =
format!("next/dist/compiled/react-dom{react_channel}/server-rendering-stub");
}
// Use server rendering stub for RSC and SSR
// x-ref: https://github.com/facebook/react/pull/25436
alias["react-dom"] =
format!("next/dist/compiled/react-dom{react_channel}/server-rendering-stub");
}

insert_exact_alias_map(import_map, project_path, alias);
Expand Down
10 changes: 5 additions & 5 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ export function createRSCAliases(
alias[
'react-dom$'
] = `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`
} else {
// x-ref: https://github.com/facebook/react/pull/25436
alias[
'react-dom$'
] = `next/dist/compiled/react-dom${bundledReactChannel}/server-rendering-stub`
}
// Use server rendering stub for RSC and SSR
// x-ref: https://github.com/facebook/react/pull/25436
alias[
'react-dom$'
] = `next/dist/compiled/react-dom${bundledReactChannel}/server-rendering-stub`
}

if (reactProductionProfiling) {
Expand Down

0 comments on commit f509de9

Please sign in to comment.