build(simulator): don't preserve modules
[e-mobility-charging-stations-simulator.git] / rollup.config.mjs
index a251ff5dab1ce283387aaac2246466b27be669ee..8ca037fb9f24753c042ee475b786197d2c36d51e 100644 (file)
@@ -7,6 +7,7 @@ import copy from 'rollup-plugin-copy';
 import del from 'rollup-plugin-delete';
 
 const isDevelopmentBuild = process.env.BUILD === 'development';
+const isAnalyzeBuild = process.env.ANALYZE;
 
 export default {
   input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
@@ -16,10 +17,7 @@ export default {
       dir: 'dist',
       format: 'esm',
       exports: 'auto',
-      sourcemap: true,
-      preserveModules: true,
-      preserveModulesRoot: 'src',
-      entryFileNames: '[name].mjs',
+      ...(isDevelopmentBuild && { sourcemap: true }),
       ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
     },
   ],
@@ -71,6 +69,6 @@ export default {
     copy({
       targets: [{ src: 'src/assets', dest: 'dist/' }],
     }),
-    isDevelopmentBuild && analyze(),
+    isAnalyzeBuild && analyze(),
   ],
 };