From d767b1c3d0e4c9391f43d83f5a1e17e07519ffaa Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 1 Sep 2026 11:57:09 +0000 Subject: [PATCH] docs: record that a shimmed package is invisible to async ESM hooks Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_019bYKAjrx5D2WSbEFCg16gb --- backend/windmill-worker/node_externals.bun.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/windmill-worker/node_externals.bun.js b/backend/windmill-worker/node_externals.bun.js index f4dd0fb26d..6591cdfea7 100644 --- a/backend/windmill-worker/node_externals.bun.js +++ b/backend/windmill-worker/node_externals.bun.js @@ -89,7 +89,9 @@ function cjsShim(specifier) { ".cjs"; mkdirSync(cjsShimDir, { recursive: true }); // The local binding is load-bearing: bun collapses a bare `module.exports = require(x)` back - // into a passthrough external import, which is the shape that breaks node. + // into a passthrough external import, which is the shape that breaks node. A shimmed package + // is reached by `require`, so node's async ESM hooks (`register()`) no longer see it; its + // sync `registerHooks()` and `--require` interception still do. writeFileSync( shim, "const mod = require(" + JSON.stringify(specifier) + ");\nmodule.exports = mod;\n"