diff --git a/packages/next/src/build/webpack-config.ts b/packages/next/src/build/webpack-config.ts index e35d3e4f6420b..521734c95b7c6 100644 --- a/packages/next/src/build/webpack-config.ts +++ b/packages/next/src/build/webpack-config.ts @@ -969,6 +969,14 @@ export default async function getBaseWebpackConfig( return false } + if (isNodeServer || isEdgeServer) { + return { + filename: `${isEdgeServer ? 'edge-chunks/' : ''}[name].js`, + chunks: 'all', + minChunks: 2, + } + } + const frameworkCacheGroup = { chunks: 'all' as const, name: 'framework', @@ -988,21 +996,6 @@ export default async function getBaseWebpackConfig( enforce: true, } - const nextRuntimeCacheGroup = { - chunks: 'all' as const, - name: 'next-runtime', - test(module: any) { - const resource = module.nameForCondition?.() - return resource - ? nextFrameworkPaths.some((pkgPath) => - resource.startsWith(pkgPath) - ) - : false - }, - priority: 30, - enforce: true, - } - const libCacheGroup = { test(module: { size: Function @@ -1045,19 +1038,6 @@ export default async function getBaseWebpackConfig( reuseExistingChunk: true, } - if (isNodeServer || isEdgeServer) { - return { - filename: `${isEdgeServer ? 'edge-chunks/' : ''}[name].js`, - cacheGroups: { - nextRuntime: nextRuntimeCacheGroup, - framework: frameworkCacheGroup, - lib: libCacheGroup, - }, - chunks: 'all', - minChunks: 2, - } - } - // client chunking const cssCacheGroup = { test: /\.(css|sass|scss)$/i,