Commit | Line | Data |
---|---|---|
f412fe24 | 1 | import json from '@rollup/plugin-json'; |
cb1948a3 | 2 | import analyze from 'rollup-plugin-analyzer'; |
c4a19794 | 3 | import copy from 'rollup-plugin-copy'; |
44b07a21 | 4 | import del from 'rollup-plugin-delete'; |
fc201913 | 5 | import { terser } from 'rollup-plugin-terser'; |
ae8ee665 | 6 | import ts from 'rollup-plugin-ts'; |
44b07a21 | 7 | |
1d064457 JB |
8 | const isDevelopmentBuild = process.env.BUILD === 'development'; |
9 | ||
44b07a21 | 10 | export default { |
5a010bf0 | 11 | input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'], |
44a95b7f JB |
12 | output: [ |
13 | { | |
14 | dir: 'dist', | |
15 | format: 'es', | |
16 | exports: 'auto', | |
17 | sourcemap: true, | |
18 | preserveModules: true, | |
19 | preserveModulesRoot: 'src', | |
20 | entryFileNames: '[name].mjs', | |
21 | ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), | |
22 | }, | |
23 | { | |
24 | dir: 'dist', | |
25 | format: 'cjs', | |
26 | exports: 'auto', | |
27 | sourcemap: true, | |
28 | preserveModules: true, | |
29 | preserveModulesRoot: 'src', | |
30 | entryFileNames: '[name].cjs', | |
31 | ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), | |
32 | }, | |
33 | ], | |
e7aeea18 | 34 | external: [ |
e3018bc4 JB |
35 | '@mikro-orm/core', |
36 | '@mikro-orm/reflection', | |
37 | 'ajv', | |
e3018bc4 | 38 | 'ajv-formats', |
97613dc6 | 39 | 'async_hooks', |
e7aeea18 JB |
40 | 'basic-ftp', |
41 | 'chalk', | |
e7aeea18 | 42 | 'fs', |
1f7fa4de | 43 | 'http', |
852a4c5f | 44 | 'http-status-codes', |
088ee3c1 JB |
45 | 'just-clone', |
46 | 'just-merge', | |
7c72977b | 47 | 'mnemonist/lru-map-with-delete', |
0bb3ee61 | 48 | 'moment', |
e7aeea18 | 49 | 'mongodb', |
0c7370da JB |
50 | 'node:crypto', |
51 | 'node:util', | |
e7aeea18 JB |
52 | 'path', |
53 | 'perf_hooks', | |
54 | 'poolifier', | |
55 | 'proper-lockfile', | |
e7aeea18 JB |
56 | 'tar', |
57 | 'url', | |
e3018bc4 | 58 | 'winston', |
e7aeea18 | 59 | 'winston-daily-rotate-file', |
65b0c151 | 60 | 'winston/lib/winston/transports', |
e7aeea18 | 61 | 'worker_threads', |
e3018bc4 | 62 | 'ws', |
e7aeea18 | 63 | ], |
44b07a21 | 64 | plugins: [ |
84e52c2c | 65 | json(), |
ae8ee665 JB |
66 | ts({ |
67 | tsconfig: 'tsconfig.json', | |
e7aeea18 | 68 | browserslist: false, |
44b07a21 JB |
69 | }), |
70 | del({ | |
045639f5 JB |
71 | targets: [ |
72 | 'dist/*', | |
73 | '!dist/assets', | |
74 | 'dist/assets/*.json', | |
75 | 'dist/assets/station-templates', | |
76 | 'dist/assets/json-schemas', | |
77 | ], | |
c4a19794 JB |
78 | }), |
79 | copy({ | |
e7aeea18 | 80 | targets: [{ src: 'src/assets', dest: 'dist/' }], |
cb1948a3 | 81 | }), |
e7aeea18 JB |
82 | isDevelopmentBuild && analyze(), |
83 | ], | |
44b07a21 | 84 | }; |