cli: allow js files to be processed by nodeTransform

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2025-07-25 15:35:21 +01:00
parent 770c2c76c1
commit a6af7684a8
2 changed files with 9 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Allow js files to be processed by the nodeTransform loader
+4 -4
View File
@@ -127,10 +127,10 @@ async function withDetectedModuleType(resolved) {
};
}
// TODO(Rugvip): Afaik this should never happen and we can remove this check, but want it here for a little while to verify.
if (ext === '.js') {
throw new Error('Unexpected .js file without explicit format');
}
// Under normal circumstances .js files should reliably have a format and so
// we should only reach this point for .ts files. However, if additional
// custom loaders are being used the format may not be detected for .js files
// either. As such we don't restrict the file format at this point.
// TODO(Rugvip): Does this need caching? kept it simple for now but worth exploring
const packageJsonPath = await findPackageJSON(fileURLToPath(resolved.url));