X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.js;h=46683b3b1f9900d71aaf90b136efe296947936eb;hb=778f79241952fefd769c87b195e01e8101964928;hp=37bc67999fa8034f1e2d9035eca94ef065d7148d;hpb=adaf9edbfbf064d5d244af85a7539c1e5793cc30;p=e-mobility-charging-stations-simulator.git diff --git a/rollup.config.js b/rollup.config.js index 37bc6799..46683b3b 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,24 +1,32 @@ +import analyze from 'rollup-plugin-analyzer'; import copy from 'rollup-plugin-copy'; import del from 'rollup-plugin-delete'; +import istanbul from 'rollup-plugin-istanbul'; +import json from '@rollup/plugin-json'; +import { terser } from 'rollup-plugin-terser'; import typescript from 'rollup-plugin-typescript2'; const isDevelopmentBuild = process.env.BUILD === 'development'; export default { input: ['src/start.ts', 'src/charging-station/StationWorker.ts'], - output: { + output: + { dir: 'dist', format: 'cjs', exports: 'auto', sourcemap: true, preserveModules: true, - preserveModulesRoot: 'src' + preserveModulesRoot: 'src', + ...!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] } }, external: ['crypto', 'perf_hooks', 'fs', 'path', 'poolifier', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'], plugins: [ + json(), typescript({ tsconfig: 'tsconfig.json' }), + isDevelopmentBuild && istanbul(), del({ targets: 'dist/*' }), @@ -26,6 +34,7 @@ export default { targets: [ { src: 'src/assets', dest: 'dist/' } ] - }) + }), + isDevelopmentBuild && analyze() ] };