Skip to content

Commit

Permalink
fix(vite-node): improve debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 14, 2023
1 parent c1dbcb4 commit 488b153
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite-node/src/client.ts
Expand Up @@ -246,12 +246,12 @@ export class ViteNodeRunner {
/** @internal */
async dependencyRequest(id: string, fsPath: string, callstack: string[]) {
const getStack = () => {
return `stack:\n${[...callstack, fsPath].reverse().map(p => `- ${p}`).join('\n')}`
return `stack:\n${[...callstack, fsPath].reverse().map(p => ` - ${p}`).join('\n')}`
}

let debugTimer: any
if (this.debug)
debugTimer = setTimeout(() => console.warn(() => `module ${fsPath} takes over 2s to load.\n${getStack()}`), 2000)
debugTimer = setTimeout(() => console.warn(`[vite-node] module ${fsPath} takes over 2s to load.\n${getStack()}`), 2000)

try {
if (callstack.includes(fsPath)) {
Expand Down

0 comments on commit 488b153

Please sign in to comment.