File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import defu from 'defu'
1616import { resolveModulePath } from 'exsolve'
1717import { toNodeListener } from 'h3'
1818import { listen } from 'listhen'
19- import { resolve } from 'pathe'
19+ import { join , resolve } from 'pathe'
2020import { debounce } from 'perfect-debounce'
2121import { toNodeHandler } from 'srvx/node'
2222import { provider } from 'std-env'
@@ -425,10 +425,12 @@ export class NuxtDevServer extends EventEmitter<DevServerEventMap> {
425425 }
426426
427427 const kit = await loadKit ( this . options . cwd )
428- await Promise . all ( [
429- kit . writeTypes ( this . #currentNuxt) . catch ( console . error ) ,
430- kit . buildNuxt ( this . #currentNuxt) ,
431- ] )
428+ // ensure tsconfigs exist before starting the dev server (vite relies on in the initialisation stage)
429+ const typesPromise = existsSync ( join ( this . #currentNuxt. options . buildDir , 'tsconfig.json' ) )
430+ ? kit . writeTypes ( this . #currentNuxt) . catch ( console . error )
431+ : await kit . writeTypes ( this . #currentNuxt) . catch ( console . error )
432+
433+ await Promise . all ( [ typesPromise , kit . buildNuxt ( this . #currentNuxt) ] )
432434
433435 if ( ! this . #currentNuxt. server ) {
434436 throw new Error ( 'Nitro server has not been initialized.' )
You can’t perform that action at this time.
0 commit comments