Commit | Line | Data |
---|---|---|
cb1948a3 | 1 | import analyze from 'rollup-plugin-analyzer'; |
c4a19794 | 2 | import copy from 'rollup-plugin-copy'; |
44b07a21 | 3 | import del from 'rollup-plugin-delete'; |
4082efc1 | 4 | import istanbul from 'rollup-plugin-istanbul'; |
84e52c2c | 5 | import json from '@rollup/plugin-json'; |
fc201913 | 6 | import { terser } from 'rollup-plugin-terser'; |
c4a19794 | 7 | import typescript from 'rollup-plugin-typescript2'; |
44b07a21 | 8 | |
1d064457 JB |
9 | const isDevelopmentBuild = process.env.BUILD === 'development'; |
10 | ||
44b07a21 | 11 | export default { |
07f35004 | 12 | input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'], |
fc201913 JB |
13 | output: |
14 | { | |
44b07a21 JB |
15 | dir: 'dist', |
16 | format: 'cjs', | |
17 | exports: 'auto', | |
18 | sourcemap: true, | |
19 | preserveModules: true, | |
fc201913 JB |
20 | preserveModulesRoot: 'src', |
21 | ...!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] } | |
44b07a21 | 22 | }, |
8eac9a09 | 23 | external: ['basic-ftp', 'chalk', 'crypto', 'perf_hooks', 'fs', 'path', 'poolifier', 'tar', 'url', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'], |
44b07a21 | 24 | plugins: [ |
84e52c2c | 25 | json(), |
c4a19794 | 26 | typescript({ |
44b07a21 JB |
27 | tsconfig: 'tsconfig.json' |
28 | }), | |
4082efc1 | 29 | isDevelopmentBuild && istanbul(), |
44b07a21 JB |
30 | del({ |
31 | targets: 'dist/*' | |
c4a19794 JB |
32 | }), |
33 | copy({ | |
34 | targets: [ | |
35 | { src: 'src/assets', dest: 'dist/' } | |
36 | ] | |
cb1948a3 JB |
37 | }), |
38 | isDevelopmentBuild && analyze() | |
44b07a21 JB |
39 | ] |
40 | }; |