1
0

Avoid infinite look finding a node_modules directory

This commit is contained in:
Zef Hemel 2022-07-25 14:11:06 +02:00
parent 88121da341
commit 155a75609b

View File

@ -37,7 +37,11 @@ class NodeWorkerWrapper implements WorkerLike {
// Look for the node_modules directory, to be passed to the worker to find e.g. the vm2 module
export let nodeModulesDir = __dirname;
while (!fs.existsSync(nodeModulesDir + "/node_modules/vm2")) {
while (
!fs.existsSync(nodeModulesDir + "/node_modules/vm2") &&
nodeModulesDir !== "/"
) {
nodeModulesDir = path.dirname(nodeModulesDir);
}