mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Make corpus 6839's package an island with a spread require
Main resolves computed createRequire specifiers at run time, so the package's computed require no longer makes an island; a spread argument list still does.
This commit is contained in:
+3
-3
@@ -1,8 +1,8 @@
|
||||
// The loader picks its part with a computed require() specifier, which
|
||||
// scriptc does not compile natively: the package runs in a Node island.
|
||||
// The loader requires its part with spread arguments, which scriptc does
|
||||
// not compile natively: the package runs in a Node island.
|
||||
import { createRequire } from "node:module";
|
||||
const load = createRequire(import.meta.url);
|
||||
const { Route } = ["./route.cjs"].map((p) => load(p))[0];
|
||||
const { Route } = load(...["./route.cjs"]);
|
||||
export function route(path, weight) {
|
||||
return new Route(path, weight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user