Unverified Commit 618dc2ee authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix require-hook with just pages on deploy (#49274)

parent 25a9547c
......@@ -283,8 +283,12 @@ export default async function build(
const publicDir = path.join(dir, 'public')
const isAppDirEnabled = !!config.experimental.appDir
const { pagesDir, appDir } = findPagesDir(dir, isAppDirEnabled)
NextBuildContext.pagesDir = pagesDir
NextBuildContext.appDir = appDir
hasAppDir = Boolean(appDir)
if (isAppDirEnabled) {
if (isAppDirEnabled && hasAppDir) {
if (!process.env.__NEXT_TEST_MODE && ciEnvironment.hasNextSupport) {
const requireHook = require.resolve('../server/require-hook')
const contents = await promises.readFile(requireHook, 'utf8')
......@@ -297,11 +301,6 @@ export default async function build(
}
}
const { pagesDir, appDir } = findPagesDir(dir, isAppDirEnabled)
NextBuildContext.pagesDir = pagesDir
NextBuildContext.appDir = appDir
hasAppDir = Boolean(appDir)
const isSrcDir = path
.relative(dir, pagesDir || appDir || '')
.startsWith('src')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment