Skip to content

Commit

Permalink
Fix loader rule with wrong matching conditions (#47261
Browse files Browse the repository at this point in the history
This Webpack loader rule should have the exactly same conditions as


https://github.com/vercel/next.js/blob/828fd5a162b02c41cbfbef539688ae454594f24c/packages/next/src/build/webpack-config.ts#L1940-L1951

Except that it matches 2 special layers and an extra loader.
  • Loading branch information
shuding committed Mar 17, 2023
1 parent 5ed66e5 commit e42a3d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/next/src/build/webpack-config.ts
Expand Up @@ -1917,18 +1917,20 @@ export default async function getBaseWebpackConfig(
use: swcLoaderForServerLayer,
},
{
test: codeCondition.test,
...codeCondition,
issuerLayer: {
or: [WEBPACK_LAYERS.client, WEBPACK_LAYERS.appClient],
},
exclude: [staticGenerationAsyncStorageRegex],
exclude: [
staticGenerationAsyncStorageRegex,
codeCondition.exclude,
],
use: [
...(dev && isClient
? [
require.resolve(
'next/dist/compiled/@next/react-refresh-utils/dist/loader'
),
defaultLoaders.babel,
]
: []),
{
Expand Down
Expand Up @@ -41,7 +41,7 @@ https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox app default Node.js builtins 1`] = `
"./node_modules/my-package/index.js:2:22
"./node_modules/my-package/index.js:2:0
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
Expand Down

0 comments on commit e42a3d6

Please sign in to comment.