X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=rollup.config.mjs;h=394de0e274f7cca046131921aae821adadc4c10b;hb=480fecf6f69bc342772aa161c4452e2b544e12a4;hp=be738ef7d947b67444b9f261c66cd10d5db90d69;hpb=2820900f6eb56e178fda80e6ed7eaaa8103cf0d3;p=e-mobility-charging-stations-simulator.git diff --git a/rollup.config.mjs b/rollup.config.mjs index be738ef7..394de0e2 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,48 +1,66 @@ +import json from '@rollup/plugin-json'; import analyze from 'rollup-plugin-analyzer'; import copy from 'rollup-plugin-copy'; import del from 'rollup-plugin-delete'; -import istanbul from 'rollup-plugin-istanbul'; -import json from '@rollup/plugin-json'; import { terser } from 'rollup-plugin-terser'; import ts from 'rollup-plugin-ts'; const isDevelopmentBuild = process.env.BUILD === 'development'; export default { - input: ['src/start.ts', 'src/ui/httpd/start.ts', 'src/charging-station/ChargingStationWorker.ts'], - output: { - dir: 'dist', - format: 'cjs', - exports: 'auto', - sourcemap: true, - preserveModules: true, - preserveModulesRoot: 'src', - ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), - }, + input: ['src/start.ts', 'src/charging-station/ChargingStationWorker.ts'], + output: [ + { + dir: 'dist', + format: 'esm', + exports: 'auto', + sourcemap: true, + preserveModules: true, + preserveModulesRoot: 'src', + entryFileNames: '[name].mjs', + ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), + }, + { + dir: 'dist', + format: 'cjs', + exports: 'auto', + sourcemap: true, + preserveModules: true, + preserveModulesRoot: 'src', + entryFileNames: '[name].cjs', + ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }), + }, + ], external: [ - 'basic-ftp', - 'chalk', - 'crypto', - 'express', - 'fs', '@mikro-orm/core', '@mikro-orm/reflection', + 'ajv', + 'ajv-formats', + 'basic-ftp', + 'chalk', + 'http-status-codes', + 'just-clone', + 'just-merge', 'mnemonist/lru-map-with-delete', 'moment', 'mongodb', - 'path', - 'perf_hooks', + 'node:async_hooks', + 'node:crypto', + 'node:fs', + 'node:http', + 'node:path', + 'node:perf_hooks', + 'node:stream', + 'node:url', + 'node:util', + 'node:worker_threads', 'poolifier', 'proper-lockfile', - 'reflect-metadata', 'tar', - 'url', - 'uuid', - 'ws', + 'winston', 'winston-daily-rotate-file', 'winston/lib/winston/transports', - 'winston', - 'worker_threads', + 'ws', ], plugins: [ json(), @@ -50,9 +68,14 @@ export default { tsconfig: 'tsconfig.json', browserslist: false, }), - isDevelopmentBuild && istanbul(), del({ - targets: ['dist/*', '!dist/assets', 'dist/assets/*.json', 'dist/assets/station-templates'], + targets: [ + 'dist/*', + '!dist/assets', + 'dist/assets/*.json', + 'dist/assets/station-templates', + 'dist/assets/json-schemas', + ], }), copy({ targets: [{ src: 'src/assets', dest: 'dist/' }],