Skip to content

Commit

Permalink
Remove ineffective webpack rules and unused app-page context modules
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed May 3, 2024
1 parent eba364a commit 1d8f2ca
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 36 deletions.
31 changes: 9 additions & 22 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,14 +1275,6 @@ export default async function getBaseWebpackConfig(
},
...(hasAppDir
? [
{
layer: WEBPACK_LAYERS.appRouteHandler,
test: new RegExp(
`private-next-app-dir\\/.*\\/route\\.(${pageExtensions.join(
'|'
)})$`
),
},
{
// Make sure that AsyncLocalStorage module instance is shared between server and client
// layers.
Expand Down Expand Up @@ -1702,23 +1694,18 @@ export default async function getBaseWebpackConfig(
'.shared-runtime'
)
const layer = resource.contextInfo.issuerLayer

console.log('layer', layer)
let runtime

switch (layer) {
case WEBPACK_LAYERS.appRouteHandler:
runtime = 'app-route'
break
case WEBPACK_LAYERS.serverSideRendering:
case WEBPACK_LAYERS.reactServerComponents:
case WEBPACK_LAYERS.appPagesBrowser:
case WEBPACK_LAYERS.actionBrowser:
runtime = 'app-page'
break
default:
runtime = 'pages'
if (layer === WEBPACK_LAYERS.serverSideRendering) {
runtime = 'app-page'
} else if (!layer) {
runtime = 'pages'
} else {
throw new Error(
`shared-runtime module ${moduleName} cannot be used in ${layer} layer`
)
}

resource.request = `next/dist/server/future/route-modules/${runtime}/vendored/contexts/${moduleName}`
}
),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@ export * as ServerInsertedHtml from '../../../../../../shared/lib/server-inserte
export * as AppRouterContext from '../../../../../../shared/lib/app-router-context.shared-runtime'
export * as HooksClientContext from '../../../../../../shared/lib/hooks-client-context.shared-runtime'
export * as RouterContext from '../../../../../../shared/lib/router-context.shared-runtime'
export * as HtmlContext from '../../../../../../shared/lib/html-context.shared-runtime'
export * as AmpContext from '../../../../../../shared/lib/amp-context.shared-runtime'
export * as LoadableContext from '../../../../../../shared/lib/loadable-context.shared-runtime'
export * as ImageConfigContext from '../../../../../../shared/lib/image-config-context.shared-runtime'
export * as Loadable from '../../../../../../shared/lib/loadable.shared-runtime'

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 1d8f2ca

Please sign in to comment.