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({ ...@@ -78,7 +78,7 @@ export async function getStaticInfoIncludingLayouts({
if (process.env.__NEXT_TEST_MODE && process.env.IS_TURBOPACK_TEST) { if (process.env.__NEXT_TEST_MODE && process.env.IS_TURBOPACK_TEST) {
/// In the e2e tests, ensure parity between webpack and Turbopack static info /// In the e2e tests, ensure parity between webpack and Turbopack static info
let reference = await getStaticInfoIncludingLayoutsInner({ let reference = await getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir, isInsideAppDir,
pageExtensions, pageExtensions,
pageFilePath, pageFilePath,
...@@ -154,7 +154,7 @@ export async function getStaticInfoIncludingLayouts({ ...@@ -154,7 +154,7 @@ export async function getStaticInfoIncludingLayouts({
return readStaticInfo() return readStaticInfo()
} }
} else { } else {
return getStaticInfoIncludingLayoutsInner({ return getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir, isInsideAppDir,
pageExtensions, pageExtensions,
pageFilePath, pageFilePath,
...@@ -166,7 +166,7 @@ export async function getStaticInfoIncludingLayouts({ ...@@ -166,7 +166,7 @@ export async function getStaticInfoIncludingLayouts({
} }
} }
async function getStaticInfoIncludingLayoutsInner({ export async function getStaticInfoIncludingLayoutsFromSource({
isInsideAppDir, isInsideAppDir,
pageExtensions, pageExtensions,
pageFilePath, pageFilePath,
......
...@@ -124,7 +124,6 @@ import { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading ...@@ -124,7 +124,6 @@ import { ensureLeadingSlash } from '../../../shared/lib/page-path/ensure-leading
import { Lockfile, type DevServerInfo } from '../../../build/lockfile' import { Lockfile, type DevServerInfo } from '../../../build/lockfile'
import { deobfuscateText } from '../../../shared/lib/magic-identifier' import { deobfuscateText } from '../../../shared/lib/magic-identifier'
import { RouteKind } from '../../route-kind' import { RouteKind } from '../../route-kind'
import { Bundler } from '../../../lib/bundler'
export type SetupOpts = { export type SetupOpts = {
renderServer: LazyRenderServerInstance renderServer: LazyRenderServerInstance
...@@ -644,11 +643,15 @@ async function startWatcher( ...@@ -644,11 +643,15 @@ async function startWatcher(
}) })
if (isMiddlewareFile(rootFile)) { 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') require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts')
).getStaticInfoIncludingLayouts ).getStaticInfoIncludingLayoutsFromSource
const staticInfo = await getStaticInfoIncludingLayouts({ const staticInfo = await getStaticInfoIncludingLayoutsFromSource({
dir,
pageFilePath: fileName, pageFilePath: fileName,
config: nextConfig, config: nextConfig,
appDir: appDir, appDir: appDir,
...@@ -656,11 +659,6 @@ async function startWatcher( ...@@ -656,11 +659,6 @@ async function startWatcher(
isDev: true, isDev: true,
isInsideAppDir: isAppPath, isInsideAppDir: isAppPath,
pageExtensions: nextConfig.pageExtensions, pageExtensions: nextConfig.pageExtensions,
bundler: opts?.turbo
? Bundler.Turbopack
: process.env.NEXT_RSPACK
? Bundler.Rspack
: Bundler.Webpack,
}) })
if (nextConfig.output === 'export') { if (nextConfig.output === 'export') {
Log.error( 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