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 copy from 'rollup-plugin-copy';
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'],
dir: 'dist',
format: 'esm',
exports: 'auto',
- sourcemap: true,
- preserveModules: true,
- preserveModulesRoot: 'src',
- entryFileNames: '[name].mjs',
+ ...(isDevelopmentBuild && { sourcemap: true }),
...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }),
},
],
'mongodb',
'node:async_hooks',
'node:crypto',
+ 'node:events',
'node:fs',
'node:http',
'node:path',
'node:util',
'node:worker_threads',
'poolifier',
- 'proper-lockfile',
'tar',
'winston',
'winston-daily-rotate-file',
plugins: [
json(),
typescript({
- tsconfig: 'tsconfig-base.json',
+ tsconfig: 'tsconfig.json',
}),
del({
targets: [
],
}),
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/**/*',
+ ],
}),
- isDevelopmentBuild && analyze(),
+ isAnalyzeBuild && analyze(),
],
};