0b5dad848878c3c75c5ca64a15af8a602bc99485
[e-mobility-charging-stations-simulator.git] / rollup.config.js
1 import analyze from 'rollup-plugin-analyzer';
2 import copy from 'rollup-plugin-copy';
3 import del from 'rollup-plugin-delete';
4 import istanbul from 'rollup-plugin-istanbul';
5 import json from '@rollup/plugin-json';
6 import { terser } from 'rollup-plugin-terser';
7 import typescript from 'rollup-plugin-typescript2';
8
9 const isDevelopmentBuild = process.env.BUILD === 'development';
10
11 export default {
12 input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
13 output:
14 {
15 dir: 'dist',
16 format: 'cjs',
17 exports: 'auto',
18 sourcemap: true,
19 preserveModules: true,
20 preserveModulesRoot: 'src',
21 ...!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }
22 },
23 external: ['basic-ftp', 'chalk', 'crypto', 'fs', '@mikro-orm/core', 'mongodb', 'path', 'perf_hooks', 'poolifier', 'reflect-metadata', 'tar', 'url', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'],
24 plugins: [
25 json(),
26 typescript({
27 tsconfig: 'tsconfig.json'
28 }),
29 isDevelopmentBuild && istanbul(),
30 del({
31 targets: 'dist/*'
32 }),
33 copy({
34 targets: [
35 { src: 'src/assets', dest: 'dist/' }
36 ]
37 }),
38 isDevelopmentBuild && analyze()
39 ]
40 };