Skip to content

Commit

Permalink
fix react refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Dec 14, 2023
1 parent b4c98ae commit 6392e41
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ export default async function getBaseWebpackConfig(

// client components layers: SSR + browser
const swcLoaderForClientLayer = [
...reactRefreshLoaders,
{
// This loader handles actions and client entries
// in the client layer.
Expand Down Expand Up @@ -1391,15 +1390,29 @@ export default async function getBaseWebpackConfig(
},
{
test: codeCondition.test,
issuerLayer: [WEBPACK_LAYERS.appPagesBrowser],
issuerLayer: WEBPACK_LAYERS.appPagesBrowser,
use: swcLoaderForClientLayer,
resolve: {
mainFields: getMainField(compilerType, true),
},
},
// Do not apply react-refresh-loader to node_modules for app router browser layer
...(dev && isClient
? [
{
test: codeCondition.test,
exclude: codeCondition.exclude,
issuerLayer: WEBPACK_LAYERS.appPagesBrowser,
use: reactRefreshLoaders,
resolve: {
mainFields: getMainField(compilerType, true),
},
},
]
: []),
{
test: codeCondition.test,
issuerLayer: [WEBPACK_LAYERS.serverSideRendering],
issuerLayer: WEBPACK_LAYERS.serverSideRendering,
use: swcLoaderForClientLayer,
resolve: {
mainFields: getMainField(compilerType, true),
Expand Down

0 comments on commit 6392e41

Please sign in to comment.