Skip to content

Commit

Permalink
Add new alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jan 21, 2021
1 parent e95e7f8 commit 0c8f509
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/next/build/webpack-config.ts
Expand Up @@ -341,6 +341,13 @@ export default async function getBaseWebpackConfig(
}
}

const clientResolveRewrites = require.resolve(
'next/dist/next-server/lib/router/utils/resolve-rewrites'
)
const clientResolveRewritesNoop = require.resolve(
'next/dist/next-server/lib/router/utils/resolve-rewrites-noop'
)

const resolveConfig = {
// Disable .mjs for node_modules bundling
extensions: isServer
Expand Down Expand Up @@ -379,6 +386,9 @@ export default async function getBaseWebpackConfig(
[DOT_NEXT_ALIAS]: distDir,
...getOptimizedAliases(isServer),
...getReactProfilingInProduction(),
[clientResolveRewrites]: hasRewrites
? clientResolveRewrites
: clientResolveRewritesNoop,
},
mainFields: isServer ? ['main', 'module'] : ['browser', 'module', 'main'],
plugins: isWebpack5
Expand Down
@@ -0,0 +1 @@
export default function resolveRewrites() {}

0 comments on commit 0c8f509

Please sign in to comment.