sliftutils 0.7.11 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundler/bundleRequire.ts +13 -13
- package/package.json +1 -1
package/bundler/bundleRequire.ts
CHANGED
|
@@ -47,25 +47,25 @@ export function bundleRequire(config: BundleRequireConfig) {
|
|
|
47
47
|
child_process: {},
|
|
48
48
|
events: class EventEmitter { },
|
|
49
49
|
};
|
|
50
|
-
// If is nodeJs
|
|
51
|
-
let allBuiltInModules = new Set<string>();
|
|
52
|
-
// Electron
|
|
53
|
-
allBuiltInModules.add("electron");
|
|
54
|
-
allBuiltInModules.add("original-fs");
|
|
55
|
-
allBuiltInModules.add("vscode");
|
|
56
50
|
if (typeof document === "undefined" && typeof require !== "undefined") {
|
|
51
|
+
const builtInRequire = globalThis.require;
|
|
52
|
+
let allBuiltInModules = new Set<string>();
|
|
53
|
+
allBuiltInModules.add("electron");
|
|
54
|
+
allBuiltInModules.add("original-fs");
|
|
55
|
+
allBuiltInModules.add("vscode");
|
|
57
56
|
// Change the builts ins to use the actual built ins!
|
|
58
57
|
let { builtinModules } = require("node:module");
|
|
59
58
|
for (let key of builtinModules) {
|
|
60
59
|
allBuiltInModules.add(key);
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
|
|
62
|
+
for (let key of allBuiltInModules) {
|
|
63
|
+
Object.defineProperty(builtInModuleExports, key, {
|
|
64
|
+
get() {
|
|
65
|
+
return builtInRequire(key);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// Just path.resolve (but needs to be reimplemented, because we can't use imports)
|