Unverified Commit 11c99531 authored by Ben Gubler's avatar Ben Gubler Committed by GitHub

fix: add path normalization to getRelativePath for Windows (#82918)

See
https://github.com/vercel/next.js/pull/82761#pullrequestreview-3130058419
parent c9b8d7f7
......@@ -20,6 +20,7 @@ import {
UNDERSCORE_GLOBAL_ERROR_ROUTE,
UNDERSCORE_NOT_FOUND_ROUTE,
} from '../../../shared/lib/entry-constants'
import { normalizePathSep } from '../../../shared/lib/page-path/normalize-path-sep'
interface RouteInfo {
path: string
......@@ -170,10 +171,12 @@ export async function createRouteTypesManifest({
const getRelativePath = (filePath: string) => {
if (validatorFilePath) {
// For validator generation, calculate path relative to validator directory
return path.relative(path.dirname(validatorFilePath), filePath)
return normalizePathSep(
path.relative(path.dirname(validatorFilePath), filePath)
)
}
// For other uses, calculate path relative to project directory
return path.relative(dir, filePath)
return normalizePathSep(path.relative(dir, filePath))
}
const manifest: RouteTypesManifest = {
......
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