| 1 | import analyze from 'rollup-plugin-analyzer'; |
| 2 | import copy from 'rollup-plugin-copy'; |
| 3 | import del from 'rollup-plugin-delete'; |
| 4 | import { terser } from 'rollup-plugin-terser'; |
| 5 | import typescript from 'rollup-plugin-typescript2'; |
| 6 | |
| 7 | const isDevelopmentBuild = process.env.BUILD === 'development'; |
| 8 | |
| 9 | export default { |
| 10 | input: ['src/start.ts', 'src/charging-station/StationWorker.ts'], |
| 11 | output: |
| 12 | { |
| 13 | dir: 'dist', |
| 14 | format: 'cjs', |
| 15 | exports: 'auto', |
| 16 | sourcemap: true, |
| 17 | preserveModules: true, |
| 18 | preserveModulesRoot: 'src', |
| 19 | ...!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] } |
| 20 | }, |
| 21 | external: ['crypto', 'perf_hooks', 'fs', 'path', 'poolifier', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'], |
| 22 | plugins: [ |
| 23 | typescript({ |
| 24 | tsconfig: 'tsconfig.json' |
| 25 | }), |
| 26 | del({ |
| 27 | targets: 'dist/*' |
| 28 | }), |
| 29 | copy({ |
| 30 | targets: [ |
| 31 | { src: 'src/assets', dest: 'dist/' } |
| 32 | ] |
| 33 | }), |
| 34 | isDevelopmentBuild && analyze() |
| 35 | ] |
| 36 | }; |