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