Unverified Commit acc80693 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

keep old approach for middleware

parent 02205ae1
......@@ -78,7 +78,7 @@ export async function getStaticInfoIncludingLayouts({
if (process.env.__NEXT_TEST_MODE && process.env.IS_TURBOPACK_TEST) {
/// In the e2e tests, ensure parity between webpack and Turbopack static info
let reference = await getStaticInfoIncludingLayoutsInner({
let reference = await getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir,
pageExtensions,
pageFilePath,
......@@ -154,7 +154,7 @@ export async function getStaticInfoIncludingLayouts({
return readStaticInfo()
}
} else {
return getStaticInfoIncludingLayoutsInner({
return getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir,
pageExtensions,
pageFilePath,
......@@ -166,7 +166,7 @@ export async function getStaticInfoIncludingLayouts({
}
}
async function getStaticInfoIncludingLayoutsInner({
export async function getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir,
pageExtensions,
pageFilePath,
......
......@@ -124,7 +124,6 @@ import { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading
import { Lockfile, type DevServerInfo } from '../../../build/lockfile'
import { deobfuscateText } from '../../../shared/lib/magic-identifier'
import { RouteKind } from '../../route-kind'
import { Bundler } from '../../../lib/bundler'
export type SetupOpts = {
renderServer: LazyRenderServerInstance
......@@ -644,11 +643,15 @@ async function startWatcher(
})
if (isMiddlewareFile(rootFile)) {
const getStaticInfoIncludingLayouts = (
// This source watcher runs independently of Turbopack's endpoint writes, so generated
// static info may be missing or stale here.
//
// TODO switch this over to Turbopack emitted static-info.json once we have solved the
// double-watcher race condition situation.
const getStaticInfoIncludingLayoutsFromSource = (
require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts')
).getStaticInfoIncludingLayouts
const staticInfo = await getStaticInfoIncludingLayouts({
dir,
).getStaticInfoIncludingLayoutsFromSource
const staticInfo = await getStaticInfoIncludingLayoutsFromSource({
pageFilePath: fileName,
config: nextConfig,
appDir: appDir,
......@@ -656,11 +659,6 @@ async function startWatcher(
isDev: true,
isInsideAppDir: isAppPath,
pageExtensions: nextConfig.pageExtensions,
bundler: opts?.turbo
? Bundler.Turbopack
: process.env.NEXT_RSPACK
? Bundler.Rspack
: Bundler.Webpack,
})
if (nextConfig.output === 'export') {
Log.error(
......
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