mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
fix: leave JSON and other non-CommonJS module formats out of the //nodejs rewrite
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014bq66fSmaPvLtjnDPfMYcj
This commit is contained in:
co-authored by
Claude Opus 5
parent
b0152ef9d8
commit
8de64d4c4a
@@ -175,14 +175,16 @@ function wmCommonJsSpecs(specs, jobDir, nodePath) {
|
||||
}
|
||||
|
||||
// Node's own rule for a file's format: the extension decides, and `.js` — like an
|
||||
// extensionless entry — follows the `type` of the closest package.json.
|
||||
// extensionless entry — follows the `type` of the closest package.json. Only the
|
||||
// formats node loads through CommonJS qualify; a JSON module exposes `default`
|
||||
// alone and must keep that shape.
|
||||
function wmIsCommonJsFile(file) {
|
||||
const ext = extname(file);
|
||||
if (ext === ".mjs") {
|
||||
return false;
|
||||
if (ext === ".cjs" || ext === ".node") {
|
||||
return true;
|
||||
}
|
||||
if (ext !== ".js" && ext !== "") {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
let dir = dirname(file);
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user