Skip to content

Commit

Permalink
Again the react vs next/dist/compiled/react shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Apr 27, 2024
1 parent 4651c12 commit 59ae828
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/next/src/build/create-compiler-aliases.ts
Expand Up @@ -118,7 +118,8 @@ export function createWebpackAliases({
}
: undefined),

next: NEXT_PROJECT_ROOT,
// Bad! Would take precedence over alias `next/dist/compiled/react` in `createRSCAliases`
// next: NEXT_PROJECT_ROOT,

'styled-jsx/style$': defaultOverrides['styled-jsx/style'],
'styled-jsx$': defaultOverrides['styled-jsx'],
Expand Down Expand Up @@ -291,19 +292,32 @@ export function createRSCAliases(
}

if (isEdgeServer) {
// Why do we need these? Why aren't these resolved via import conditions?
if (layer === WEBPACK_LAYERS.reactServerComponents) {
alias[
'react$'
] = `next/dist/compiled/react${bundledReactChannel}/react.react-server`
alias[
'next/dist/compiled/react$'
] = `next/dist/compiled/react${bundledReactChannel}/react.react-server`
alias[
'react/jsx-runtime$'
] = `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`
alias[
'next/dist/compiled/react/jsx-runtime$'
] = `next/dist/compiled/react${bundledReactChannel}/jsx-runtime.react-server`
alias[
'react/jsx-dev-runtime$'
] = `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`
alias[
'next/dist/compiled/react/jsx-dev-runtime$'
] = `next/dist/compiled/react${bundledReactChannel}/jsx-dev-runtime.react-server`
alias[
'react-dom$'
] = `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`
alias[
'next/dist/compiled/react-dom$'
] = `next/dist/compiled/react-dom${bundledReactChannel}/react-dom.react-server`
}
}

Expand Down

0 comments on commit 59ae828

Please sign in to comment.