Skip to content

Commit

Permalink
share util
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 28, 2023
1 parent 9ed55e8 commit 878ca82
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/next/src/build/webpack/loaders/next-app-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { AppBundlePathNormalizer } from '../../../server/future/normalizers/buil
import { MiddlewareConfig } from '../../analysis/get-page-static-info'
import { getFilenameAndExtension } from './next-metadata-route-loader'
import { loadEntrypoint } from './next-route-loader/load-entrypoint'
import { isAppBuiltinNotFoundPage } from '../../utils'

export type AppLoaderOptions = {
name: string
Expand Down Expand Up @@ -54,8 +55,6 @@ const PAGE_SEGMENT = 'page$'
const PARALLEL_CHILDREN_SEGMENT = 'children$'

const defaultNotFoundPath = 'next/dist/client/components/not-found-error'
const defaultNotFoundPathRegex =
/next[\\/]dist[\\/]client[\\/]components[\\/]not-found-error/

type DirResolver = (pathToResolve: string) => string
type PathResolver = (
Expand Down Expand Up @@ -184,7 +183,7 @@ async function createTreeCodeFromPath(
}> {
const splittedPath = pagePath.split(/[\\/]/)
const isNotFoundRoute = page === '/_not-found'
const isDefaultNotFound = defaultNotFoundPathRegex.test(pagePath)
const isDefaultNotFound = isAppBuiltinNotFoundPage(pagePath)
const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0]
const pages: string[] = []

Expand Down

0 comments on commit 878ca82

Please sign in to comment.