Skip to content

Commit

Permalink
fix alias logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Sep 21, 2022
1 parent 72a1996 commit a096b89
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/next/build/webpack-config.ts
Expand Up @@ -1010,13 +1010,17 @@ export default async function getBaseWebpackConfig(
const resolveWithReactServerCondition =
layer === WEBPACK_LAYERS.server
? getResolve({
alias: {
...reactAliases,
'react/package.json': `${reactDir}/package.json`,
'react/jsx-runtime': `${reactDir}/jsx-runtime`,
'react/jsx-dev-runtime': `${reactDir}/jsx-dev-runtime`,
'react-dom/package.json': `${reactDomDir}/package.json`,
},
// If React is aliased to another channel during Next.js' local development,
// we need to provide that alias to webpack's resolver.
alias: process.env.__NEXT_REACT_CHANNEL
? {
...reactAliases,
'react/package.json': `${reactDir}/package.json`,
'react/jsx-runtime': `${reactDir}/jsx-runtime`,
'react/jsx-dev-runtime': `${reactDir}/jsx-dev-runtime`,
'react-dom/package.json': `${reactDomDir}/package.json`,
}
: false,
conditionNames: ['react-server'],
})
: null
Expand Down

0 comments on commit a096b89

Please sign in to comment.