cli: only pass through .mjs if ESM is supported

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-01-31 13:54:09 +01:00
parent 72f9a9d1ff
commit 9638f6d3b0
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Only allow pass through of `.mjs` in Jest transform if static ESM is supported.
+1 -1
View File
@@ -29,7 +29,7 @@ function createTransformer(config) {
}
// Skip transformation of .mjs files, they should only be used if ESM support is available
if (filePath.endsWith('.mjs')) {
if (jestOptions.supportsStaticESM && filePath.endsWith('.mjs')) {
return { code: source };
}