X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=be507238e8268c58c3e898f47c69a49e033d8b3b;hb=d4ad9d45e762ddb25f47b16c175a1509e89f422b;hp=e78c1e9e26e145eaffa217fb2b0813520e9cf6c4;hpb=942f97271c35ec7688abb1633fd2092d234422eb;p=e-mobility-charging-stations-simulator.git diff --git a/rollup.config.mjs b/rollup.config.mjs index e78c1e9e..be507238 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,9 +1,11 @@ /* eslint-disable n/no-unpublished-import */ +import { cpus } from 'node:os'; + 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'; @@ -16,9 +18,8 @@ export default { { dir: 'dist', format: 'esm', - exports: 'auto', - ...(isDevelopmentBuild && { sourcemap: true }), - ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }), + sourcemap: !!isDevelopmentBuild, + plugins: [terser({ maxWorkers: cpus().length / 2 })], }, ], external: [ @@ -56,6 +57,9 @@ export default { json(), typescript({ tsconfig: 'tsconfig.json', + compilerOptions: { + sourceMap: !!isDevelopmentBuild, + }, }), del({ targets: [ @@ -68,7 +72,15 @@ export default { ], }), 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/authorization-tags-template.json', + 'assets/ui-protocol/**/*', + ], }), isAnalyzeBuild && analyze(), ],