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'; |
ae8ee665 | 7 | import ts from 'rollup-plugin-ts'; |
44b07a21 | 8 | |
1d064457 JB |
9 | const isDevelopmentBuild = process.env.BUILD === 'development'; |
10 | ||
44b07a21 | 11 | export default { |
903becc3 | 12 | input: ['src/start.ts', 'src/ui/httpd/start.ts', 'src/charging-station/ChargingStationWorker.ts'], |
e7aeea18 | 13 | output: { |
44b07a21 JB |
14 | dir: 'dist', |
15 | format: 'cjs', | |
16 | exports: 'auto', | |
17 | sourcemap: true, | |
18 | preserveModules: true, | |
fc201913 | 19 | preserveModulesRoot: 'src', |
e7aeea18 | 20 | ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), |
44b07a21 | 21 | }, |
e7aeea18 JB |
22 | external: [ |
23 | 'basic-ftp', | |
24 | 'chalk', | |
25 | 'crypto', | |
175d4f46 | 26 | 'express', |
e7aeea18 JB |
27 | 'fs', |
28 | '@mikro-orm/core', | |
29 | '@mikro-orm/reflection', | |
0bb3ee61 | 30 | 'moment', |
e7aeea18 JB |
31 | 'mongodb', |
32 | 'path', | |
33 | 'perf_hooks', | |
34 | 'poolifier', | |
35 | 'proper-lockfile', | |
36 | 'reflect-metadata', | |
37 | 'tar', | |
38 | 'url', | |
39 | 'uuid', | |
40 | 'ws', | |
41 | 'winston-daily-rotate-file', | |
42 | 'winston/lib/winston/transports', | |
43 | 'winston', | |
44 | 'worker_threads', | |
45 | ], | |
44b07a21 | 46 | plugins: [ |
84e52c2c | 47 | json(), |
ae8ee665 JB |
48 | ts({ |
49 | tsconfig: 'tsconfig.json', | |
e7aeea18 | 50 | browserslist: false, |
44b07a21 | 51 | }), |
4082efc1 | 52 | isDevelopmentBuild && istanbul(), |
44b07a21 | 53 | del({ |
073bd098 | 54 | targets: ['dist/*', '!dist/assets', 'dist/assets/*.json', 'dist/assets/station-templates'], |
c4a19794 JB |
55 | }), |
56 | copy({ | |
e7aeea18 | 57 | targets: [{ src: 'src/assets', dest: 'dist/' }], |
cb1948a3 | 58 | }), |
e7aeea18 JB |
59 | isDevelopmentBuild && analyze(), |
60 | ], | |
44b07a21 | 61 | }; |