Skip to content

Commit

Permalink
fix: fix require reference
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 9, 2022
1 parent 85d66c5 commit 5da8b00
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/vite-node/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ export class ViteNodeRunner {
},
}

let require: NodeRequire

// Be careful when changing this
// changing context will change amount of code added on line :114 (vm.runInThisContext)
// this messes up sourcemaps for coverage
Expand All @@ -189,12 +187,7 @@ export class ViteNodeRunner {
__vitest_resolve_id__: resolveId,

// cjs compact
require: (path: string) => {
if (!require)
require = createRequire(url)

return require(path)
},
require: createRequire(url),
exports,
module: moduleProxy,
__filename,
Expand Down

0 comments on commit 5da8b00

Please sign in to comment.