Merge pull request #30651 from backstage/node-transform-allow-js

cli: allow js files to be processed by nodeTransform
This commit is contained in:
Patrik Oldsberg
2025-07-28 14:17:11 +02:00
committed by GitHub
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));