Set require("module").globalPaths to empty array

https://github.com/oven-sh/bun/issues/1641#issuecomment-1427017442
This commit is contained in:
Jarred Sumner
2023-02-12 04:35:52 -08:00
parent 8b4e58f3d2
commit 83473c60df
2 changed files with 8 additions and 0 deletions

View File

@@ -162,6 +162,9 @@ void generateNodeModuleModule(JSC::JSGlobalObject *globalObject,
exportNames.append(JSC::Identifier::fromString(vm, "builtinModules"_s));
exportNames.append(JSC::Identifier::fromString(vm, "globalPaths"_s));
exportValues.append(JSC::constructEmptyArray(globalObject, 0));
JSC::JSArray *builtinModules = JSC::JSArray::create(
vm,
globalObject->arrayStructureForIndexingTypeDuringAllocation(

View File

@@ -0,0 +1,5 @@
import { expect, test } from "bun:test";
test("module.globalPaths exists", () => {
expect(Array.isArray(require("module").globalPaths)).toBe(true);
});