Skip to content

Commit

Permalink
revert: "fix(vite-node): circular import stuck" vitest-dev#3418
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 31, 2023
1 parent c064ff9 commit 96dac13
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/vite-node/src/client.ts
Expand Up @@ -188,16 +188,13 @@ export class ViteNodeRunner {

if (!mod.importers)
mod.importers = new Set()

const isCircular = mod.importers.has(importee)

if (importee)
mod.importers.add(importee)

const getStack = () => `stack:\n${[...callstack, fsPath].reverse().map(p => ` - ${p}`).join('\n')}`

// check circular dependency
if (isCircular || callstack.includes(fsPath) || callstack.some(c => this.moduleCache.get(c).importers?.has(fsPath))) {
if (callstack.includes(fsPath) || callstack.some(c => this.moduleCache.get(c).importers?.has(fsPath))) {
if (mod.exports)
return mod.exports
}
Expand Down

0 comments on commit 96dac13

Please sign in to comment.