repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: only copy assets used at runtime in the bundle
[e-mobility-charging-stations-simulator.git]
/
rollup.config.mjs
diff --git
a/rollup.config.mjs
b/rollup.config.mjs
index 0b43e8f8d3677921ab5fc3d8054e48dbaaac2382..e660242612b1a9892dd84a0daa390819f3356dda 100644
(file)
--- a/
rollup.config.mjs
+++ b/
rollup.config.mjs
@@
-2,11
+2,12
@@
import json from '@rollup/plugin-json';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
+import { copy } from '@web/rollup-plugin-copy';
import analyze from 'rollup-plugin-analyzer';
import analyze from 'rollup-plugin-analyzer';
-import copy from 'rollup-plugin-copy';
import del from 'rollup-plugin-delete';
const isDevelopmentBuild = process.env.BUILD === 'development';
import del from 'rollup-plugin-delete';
const isDevelopmentBuild = process.env.BUILD === 'development';
+const isAnalyzeBuild = process.env.ANALYZE;
export default {
input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
export default {
input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'],
@@
-16,10
+17,7
@@
export default {
dir: 'dist',
format: 'esm',
exports: 'auto',
dir: 'dist',
format: 'esm',
exports: 'auto',
- sourcemap: true,
- preserveModules: true,
- preserveModulesRoot: 'src',
- entryFileNames: '[name].mjs',
+ ...(isDevelopmentBuild && { sourcemap: true }),
...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
},
],
...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
},
],
@@
-38,6
+36,7
@@
export default {
'mongodb',
'node:async_hooks',
'node:crypto',
'mongodb',
'node:async_hooks',
'node:crypto',
+ 'node:events',
'node:fs',
'node:http',
'node:path',
'node:fs',
'node:http',
'node:path',
@@
-47,7
+46,6
@@
export default {
'node:util',
'node:worker_threads',
'poolifier',
'node:util',
'node:worker_threads',
'poolifier',
- 'proper-lockfile',
'tar',
'winston',
'winston-daily-rotate-file',
'tar',
'winston',
'winston-daily-rotate-file',
@@
-70,8
+68,15
@@
export default {
],
}),
copy({
],
}),
copy({
- targets: [{ src: 'src/assets', dest: 'dist/' }],
+ rootDir: 'src',
+ patterns: 'assets/**/*.json',
+ exclude: [
+ 'assets/config-template.json',
+ 'assets/*config[-_]*.json',
+ 'assets/idtags-template.json',
+ 'assets/ui-protocol/**/*',
+ ],
}),
}),
- is
Development
Build && analyze(),
+ is
Analyze
Build && analyze(),
],
};
],
};