mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
Have orderkit require its part when it loads
Main resolves computed createRequire specifiers at run time, so a computed require inside a function no longer makes an island; one in module code still does.
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
// Loads its part through a computed specifier, so it runs in a Node island.
|
||||
// Loads its part through a computed specifier when it loads, so it runs in
|
||||
// a Node island.
|
||||
const { createRequire } = require("node:module");
|
||||
const parts = ["./thing"].map((p) => createRequire(__filename)(p));
|
||||
const parts = [createRequire(__filename)(["./thing"][0])];
|
||||
exports.make = () => new parts[0].Thing();
|
||||
|
||||
Reference in New Issue
Block a user