Switch rollup bundler TS plugin to rollup-plugin-ts
[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';
4082efc1 4import istanbul from 'rollup-plugin-istanbul';
84e52c2c 5import json from '@rollup/plugin-json';
fc201913 6import { terser } from 'rollup-plugin-terser';
ae8ee665 7import ts from 'rollup-plugin-ts';
44b07a21 8
1d064457
JB
9const isDevelopmentBuild = process.env.BUILD === 'development';
10
44b07a21 11export 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 },
ae8ee665 23 external: ['basic-ftp', 'chalk', 'crypto', 'fs', '@mikro-orm/core', '@mikro-orm/reflection', 'mongodb', 'path', 'perf_hooks', 'poolifier', 'reflect-metadata', 'tar', 'url', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'],
44b07a21 24 plugins: [
84e52c2c 25 json(),
ae8ee665
JB
26 ts({
27 tsconfig: 'tsconfig.json',
28 browserslist: false
44b07a21 29 }),
4082efc1 30 isDevelopmentBuild && istanbul(),
44b07a21
JB
31 del({
32 targets: 'dist/*'
c4a19794
JB
33 }),
34 copy({
35 targets: [
36 { src: 'src/assets', dest: 'dist/' }
37 ]
cb1948a3
JB
38 }),
39 isDevelopmentBuild && analyze()
44b07a21
JB
40 ]
41};