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', | |
2896e06d | 15 | format: 'esm', |
44a95b7f JB |
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', |
e7aeea18 JB |
39 | 'basic-ftp', |
40 | 'chalk', | |
852a4c5f | 41 | 'http-status-codes', |
088ee3c1 JB |
42 | 'just-clone', |
43 | 'just-merge', | |
7c72977b | 44 | 'mnemonist/lru-map-with-delete', |
0bb3ee61 | 45 | 'moment', |
e7aeea18 | 46 | 'mongodb', |
01f4001e | 47 | 'node:async_hooks', |
0c7370da | 48 | 'node:crypto', |
130783a7 | 49 | 'node:fs', |
01f4001e | 50 | 'node:http', |
130783a7 | 51 | 'node:path', |
01f4001e | 52 | 'node:perf_hooks', |
8a168938 | 53 | 'node:stream', |
130783a7 | 54 | 'node:url', |
0c7370da | 55 | 'node:util', |
01f4001e | 56 | 'node:worker_threads', |
e7aeea18 JB |
57 | 'poolifier', |
58 | 'proper-lockfile', | |
e7aeea18 | 59 | 'tar', |
e3018bc4 | 60 | 'winston', |
e7aeea18 | 61 | 'winston-daily-rotate-file', |
65b0c151 | 62 | 'winston/lib/winston/transports', |
e3018bc4 | 63 | 'ws', |
e7aeea18 | 64 | ], |
44b07a21 | 65 | plugins: [ |
84e52c2c | 66 | json(), |
ae8ee665 JB |
67 | ts({ |
68 | tsconfig: 'tsconfig.json', | |
e7aeea18 | 69 | browserslist: false, |
44b07a21 JB |
70 | }), |
71 | del({ | |
045639f5 JB |
72 | targets: [ |
73 | 'dist/*', | |
74 | '!dist/assets', | |
75 | 'dist/assets/*.json', | |
76 | 'dist/assets/station-templates', | |
77 | 'dist/assets/json-schemas', | |
78 | ], | |
c4a19794 JB |
79 | }), |
80 | copy({ | |
e7aeea18 | 81 | targets: [{ src: 'src/assets', dest: 'dist/' }], |
cb1948a3 | 82 | }), |
e7aeea18 JB |
83 | isDevelopmentBuild && analyze(), |
84 | ], | |
44b07a21 | 85 | }; |