cli: use preserveModules for CJS builds

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-10-07 17:17:47 +02:00
parent 0d74ac9e71
commit ea1663376e
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Preserve directory structure for CommonJS build output, just like ESM. This makes the build output more stable and easier to browse, and allows for more effective tree shaking and lazy imports.
+2
View File
@@ -123,6 +123,8 @@ export async function makeRollupConfigs(
format: 'commonjs',
interop: 'compat',
sourcemap: true,
preserveModules: true,
preserveModulesRoot: `${targetDir}/src`,
exports: 'named',
});
}