Commit 0063c95d authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

revert packages/next/src/server/lib/router-utils/filesystem.ts

parent 7429319c
...@@ -161,7 +161,7 @@ export async function setupFsCheck(opts: { ...@@ -161,7 +161,7 @@ export async function setupFsCheck(opts: {
}, },
headers: [], headers: [],
} }
let buildId: string | undefined let buildId = 'development'
let prerenderManifest: PrerenderManifest let prerenderManifest: PrerenderManifest
if (!opts.dev) { if (!opts.dev) {
...@@ -170,6 +170,9 @@ export async function setupFsCheck(opts: { ...@@ -170,6 +170,9 @@ export async function setupFsCheck(opts: {
buildId = await fs.readFile(buildIdPath, 'utf8') buildId = await fs.readFile(buildIdPath, 'utf8')
} catch (err: any) { } catch (err: any) {
if (err.code !== 'ENOENT') throw err if (err.code !== 'ENOENT') throw err
throw new Error(
`Could not find a production build in the '${opts.config.distDir}' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id`
)
} }
try { try {
...@@ -227,12 +230,7 @@ export async function setupFsCheck(opts: { ...@@ -227,12 +230,7 @@ export async function setupFsCheck(opts: {
const appRoutesManifestPath = path.join(distDir, APP_PATH_ROUTES_MANIFEST) const appRoutesManifestPath = path.join(distDir, APP_PATH_ROUTES_MANIFEST)
const routesManifest = JSON.parse( const routesManifest = JSON.parse(
await fs.readFile(routesManifestPath, 'utf8').catch((err) => { await fs.readFile(routesManifestPath, 'utf8')
if (err.code !== 'ENOENT') throw err
throw new Error(
`Could not find a production build in the '${opts.config.distDir}' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id`
)
})
) as RoutesManifest ) as RoutesManifest
prerenderManifest = JSON.parse( prerenderManifest = JSON.parse(
...@@ -347,8 +345,6 @@ export async function setupFsCheck(opts: { ...@@ -347,8 +345,6 @@ export async function setupFsCheck(opts: {
headers: routesManifest.headers, headers: routesManifest.headers,
} }
} else { } else {
buildId = 'development'
// dev handling // dev handling
customRoutes = await loadCustomRoutes(opts.config) customRoutes = await loadCustomRoutes(opts.config)
......
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