Allow tree-shaking of frontend plugins

Adding rollup's preserveModules to enable tree-shaking in webpack.

Signed-off-by: Tomasz Szuba <tszuba@box.com>
This commit is contained in:
Tomasz Szuba
2024-03-06 13:23:41 +01:00
parent 8dc18dc8ee
commit f97ad04a2d
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Add preserveModules to rollup, which allows better async loading and tree-shaking in webpack
+1
View File
@@ -100,6 +100,7 @@ export async function makeRollupConfigs(
chunkFileNames: `esm/[name]-[hash].esm.js`,
format: 'module',
sourcemap: true,
preserveModules: true,
});
// Assume we're building for the browser if ESM output is included
mainFields.unshift('browser');