Skip to content

Commit

Permalink
chore: add global guard
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Nov 28, 2022
1 parent 8a3a313 commit 4589fa9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,9 @@ export function arrayEqual(a: any[], b: any[]): boolean {
}

export function evalValue<T = any>(rawValue: string): T {
const fn = new Function(`return (\n${rawValue}\n)`)
const fn = new Function(`
var console, exports, global, module, process, require
return (\n${rawValue}\n)
`)
return fn()
}

0 comments on commit 4589fa9

Please sign in to comment.