Skip to content

Commit

Permalink
add more webpack config options
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Mar 21, 2022
1 parent 2fb428a commit 4176917
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/next/build/webpack-config.ts
Expand Up @@ -364,6 +364,14 @@ export default async function getBaseWebpackConfig(
'`experimental.serverComponents` requires React 18 to be installed.'
)
}
if (
config.experimental.serverComponents &&
!config.experimental.concurrentFeatures
) {
throw new Error(
'`experimental.serverComponents` requires `experimental.concurrentFeatures` to be enabled.'
)
}

const targetWeb = isEdgeRuntime || !isServer
const hasConcurrentFeatures =
Expand Down Expand Up @@ -1756,6 +1764,17 @@ export default async function getBaseWebpackConfig(
defaultLoaders,
totalPages,
webpack,
...(hasConcurrentFeatures
? {
// When concurrent features are enabled, there are both runtimes enabled
// as the server compiler. So we change the options here to make sure
// users can distinguish between all compilers.
// This can change in the future.
isServer: !isEdgeRuntime && isServer,
isEdgeServer: isEdgeRuntime && isServer,
isClient: !isServer,
}
: null),
})

if (!webpackConfig) {
Expand Down

0 comments on commit 4176917

Please sign in to comment.