-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
60 lines (58 loc) · 1.45 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import analyze from 'rollup-plugin-analyzer';
import copy from 'rollup-plugin-copy';
import del from 'rollup-plugin-delete';
import istanbul from 'rollup-plugin-istanbul';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
import ts from 'rollup-plugin-ts';
const isDevelopmentBuild = process.env.BUILD === 'development';
export default {
input: ['src/start.ts', 'src/ui/httpd/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
output: {
dir: 'dist',
format: 'cjs',
exports: 'auto',
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }),
},
external: [
'basic-ftp',
'chalk',
'crypto',
'express',
'fs',
'@mikro-orm/core',
'@mikro-orm/reflection',
'mongodb',
'path',
'perf_hooks',
'poolifier',
'proper-lockfile',
'reflect-metadata',
'tar',
'url',
'uuid',
'ws',
'winston-daily-rotate-file',
'winston/lib/winston/transports',
'winston',
'worker_threads',
],
plugins: [
json(),
ts({
tsconfig: 'tsconfig.json',
browserslist: false,
}),
isDevelopmentBuild && istanbul(),
del({
targets: ['dist/*', '!dist/assets', 'dist/assets/*.json', 'dist/assets/station-templates'],
}),
copy({
targets: [{ src: 'src/assets', dest: 'dist/' }],
}),
isDevelopmentBuild && analyze(),
],
};