11import { readFileSync , writeFileSync } from 'fs'
2+ import * as path from 'path'
23import { bold , cyan , white } from '../picocolors'
34import * as CommentJson from 'next/dist/compiled/comment-json'
45import semver from 'next/dist/compiled/semver'
@@ -267,7 +268,11 @@ export async function writeConfigurationDefaults(
267268 }
268269 }
269270
270- const nextAppTypes : string [ ] = [ `${ distDir } /types/**/*.ts` ]
271+ const distDirPosix =
272+ path . win32 . sep === path . sep
273+ ? distDir . replaceAll ( path . win32 . sep , path . posix . sep )
274+ : distDir
275+ const nextAppTypes : string [ ] = [ `${ distDirPosix } /types/**/*.ts` ]
271276
272277 // When isolatedDevBuild is enabled, Next.js uses different distDir paths:
273278 // - Development: "{distDir}/dev"
@@ -279,10 +284,10 @@ export async function writeConfigurationDefaults(
279284 process . env . NODE_ENV === 'development'
280285 ? // In dev, distDir is "{distDir}/dev", which is already in the array above, but we also need "{distDir}/types".
281286 // Here we remove "/dev" at the end of distDir for consistency.
282- `${ distDir . replace ( / \/ d e v $ / , '' ) } /types/**/*.ts`
287+ `${ distDirPosix . replace ( / \/ d e v $ / , '' ) } /types/**/*.ts`
283288 : // In build, distDir is "{distDir}", which is already in the array above, but we also need "{distDir}/dev/types".
284289 // Here we add "/dev" at the end of distDir for consistency.
285- `${ distDir } /dev/types/**/*.ts`
290+ `${ distDirPosix } /dev/types/**/*.ts`
286291 )
287292 // Sort the array to ensure consistent order.
288293 nextAppTypes . sort ( ( a , b ) => a . length - b . length )
0 commit comments