X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=26739f65d88ca4d12f75c24425ac19ef3dedcbda;hb=4460ba3309a9b3091d86bca611c697335e4f795d;hp=e3af7e1d8af9657fe50be3750b7aa4acd8671a25;hpb=211b4eb5ca5829653a7bf63d4df5c3f1aa4df755;p=poolifier.git diff --git a/rollup.config.mjs b/rollup.config.mjs index e3af7e1d..26739f65 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -24,6 +24,7 @@ const availableParallelism = () => { const isDevelopmentBuild = env.BUILD === 'development' const isAnalyzeBuild = env.ANALYZE const isDocumentationBuild = env.DOCUMENTATION +const sourcemap = env.SOURCEMAP !== 'false' const maxWorkers = Math.floor(availableParallelism() / 2) @@ -34,20 +35,23 @@ export default defineConfig([ output: [ { format: 'cjs', - sourcemap: true, ...(isDevelopmentBuild && { dir: './lib', + entryFileNames: '[name].cjs', + chunkFileNames: '[name]-[hash].cjs', preserveModules: true, preserveModulesRoot: './src' }), ...(!isDevelopmentBuild && { - file: './lib/index.js', + file: './lib/index.cjs', plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) }, { format: 'esm', - sourcemap: true, ...(isDevelopmentBuild && { dir: './lib', entryFileNames: '[name].mjs', @@ -58,6 +62,9 @@ export default defineConfig([ ...(!isDevelopmentBuild && { file: './lib/index.mjs', plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) } ], @@ -66,7 +73,7 @@ export default defineConfig([ typescript({ tsconfig: './tsconfig.build.json', compilerOptions: { - sourceMap: true + sourceMap: sourcemap } }), del({