We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4a46d3a commit 4ce1305Copy full SHA for 4ce1305
node.js
@@ -15,6 +15,7 @@
15
*/
16
17
import URL from 'url';
18
+import fs from 'fs';
19
import VM from 'vm';
20
import threads from 'worker_threads';
21
@@ -187,7 +188,7 @@ function workerThread() {
187
188
evaluateDataUrl(mod, name);
189
}
190
else {
- require(mod);
191
+ importScripts(mod);
192
193
194
catch (err) {
@@ -216,3 +217,10 @@ function parseDataUrl(url) {
216
217
218
return { type, data };
219
220
+
221
+function importScripts(...fileNames) {
222
+ for (let i=0; i < fileNames.length; i++) {
223
+ const url = fileNames[i];
224
+ VM.runInThisContext(fs.readFileSync(url,'utf-8'),{ filename: url });
225
+ }
226
+}
0 commit comments