diff --git a/backend/windmill-worker/loader_builder.bun.ts b/backend/windmill-worker/loader_builder.bun.ts index d76c68e752..f869090262 100644 --- a/backend/windmill-worker/loader_builder.bun.ts +++ b/backend/windmill-worker/loader_builder.bun.ts @@ -7,7 +7,8 @@ const bo = await Bun.build({ const fs = require("fs/promises"); -const captureVersion = /(^\@?[^\@]+)(?:\@(.+))?/; +const captureVersion = + /^((?:\@[^\/\@]+\/[^\/\@]+)|(?:[^\/\@]+))(?:\@([^\/]+))?.*$/; if (!bo.success) { bo.logs.forEach((l) => console.log(l)); @@ -22,6 +23,12 @@ if (!bo.success) { const dependencies: Record = {}; for (const i of imports) { let [_, name, version] = i.path.match(captureVersion) ?? []; + if (name == undefined) { + throw Error("Unrecognized import: " + i.path); + } + if (name.startsWith("node:")) { + continue; + } let splitted = name.split("/"); if (splitted.length > 2) { name = splitted.slice(0, 2).join("/");