Skip to content

Commit 9d4da0b

Browse files
committed
feat(dev): add debug timing log
1 parent b0c6c0d commit 9d4da0b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎packages/nuxi/src/commands/dev.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { loadKit } from '../utils/kit'
2424
import{logger}from'../utils/logger'
2525
import{cwdArgs,dotEnvArgs,envNameArgs,legacyRootDirArgs,logLevelArgs}from'./_shared'
2626

27+
letstartTime: number|undefined=Date.now()
2728
constforkSupported=!isTest&&(!isBun||isBunForkSupported())
2829
constlisthenArgs=getListhenArgs()
2930

@@ -271,6 +272,10 @@ async function _startSubprocess(devProxy: DevProxy, rawArgs: string[], listenArg
271272
childProc.on('message',(message: NuxtDevIPCMessage)=>{
272273
if(message.type==='nuxt:internal:dev:ready'){
273274
devProxy.setAddress(`http://127.0.0.1:${message.port}`)
275+
if(startTime){
276+
logger.debug(`Dev server ready for connections in ${Date.now()-startTime}ms`)
277+
startTime=undefined
278+
}
274279
}
275280
elseif(message.type==='nuxt:internal:dev:loading'){
276281
devProxy.setAddress(undefined)

‎packages/nuxi/src/main.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const main = defineCommand({
3333
subCommands: commands,
3434
asyncsetup(ctx){
3535
constcommand=ctx.args._[0]
36+
logger.debug(`Running \`nuxt ${command}\` command`)
3637
constdev=command==='dev'
3738
setupGlobalConsole({ dev })
3839

0 commit comments

Comments
 (0)