X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.js;h=61749bf9be47a549f082797ae136fcbacb2b6c40;hb=c27c3eeea356b0692bef2327bb59aa99f9cbad8d;hp=37bc67999fa8034f1e2d9035eca94ef065d7148d;hpb=1d0644574183c8eb3c5194f5f2885de0d9298a3e;p=e-mobility-charging-stations-simulator.git diff --git a/rollup.config.js b/rollup.config.js index 37bc6799..61749bf9 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: { + input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'], + 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'], + external: ['basic-ftp', 'chalk', 'crypto', 'mongodb', 'perf_hooks', 'fs', 'path', 'poolifier', 'reflect-metadata', 'tar', 'typeorm', 'url', '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() ] };