Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete code from loader #38681

Merged
merged 2 commits into from Jul 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions packages/next/build/webpack/loaders/next-app-loader.ts
Expand Up @@ -16,12 +16,6 @@ async function createTreeCodeFromPath({
const appDirPrefix = splittedPath[0]

const segments = ['', ...splittedPath.slice(1)]
const isNewRootLayout =
segments[0]?.length > 2 &&
segments[0]?.startsWith('(') &&
segments[0]?.endsWith(')')

let isCustomRootLayout = false

// segment.length - 1 because arrays start at 0 and we're decrementing
for (let i = segments.length - 1; i >= 0; i--) {
Expand All @@ -43,11 +37,6 @@ async function createTreeCodeFromPath({
const resolvedLayoutPath = await resolve(layoutPath)
const resolvedLoadingPath = await resolve(loadingPath)

// if we are in a new root app/(root) and a custom root layout was
// not provided or a root layout app/layout is not present, we use
// a default root layout to provide the html/body tags
isCustomRootLayout = isNewRootLayout && i === 1

// Existing tree are the children of the current segment
const children = tree

Expand All @@ -68,11 +57,6 @@ async function createTreeCodeFromPath({
: ''
}
}]`

// if we're in a new root layout don't add the top-level app/layout
if (isCustomRootLayout) {
break
}
}

return `const tree = ${tree};`
Expand Down