X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=b7abc9c5430f6212c6b5e7e79aa2f351285086d2;hb=be55f2ca8b4792c645c4aaee38f0e3471a1efcb2;hp=8f1f26562a4817d75a018129b3a09f76fd9129ab;hpb=49fb18fe8d6e6a35ceabe2bce83b26073871e3b0;p=poolifier.git diff --git a/rollup.config.mjs b/rollup.config.mjs index 8f1f2656..b7abc9c5 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) @@ -36,21 +37,21 @@ export default defineConfig([ format: 'cjs', ...(isDevelopmentBuild && { dir: './lib', - sourcemap: true, preserveModules: true, preserveModulesRoot: './src' }), ...(!isDevelopmentBuild && { file: './lib/index.js', - sourcemap: true, plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) }, { format: 'esm', ...(isDevelopmentBuild && { dir: './lib', - sourcemap: true, entryFileNames: '[name].mjs', chunkFileNames: '[name]-[hash].mjs', preserveModules: true, @@ -58,8 +59,10 @@ export default defineConfig([ }), ...(!isDevelopmentBuild && { file: './lib/index.mjs', - sourcemap: true, plugins: [terser({ maxWorkers })] + }), + ...(sourcemap && { + sourcemap }) } ], @@ -75,13 +78,16 @@ export default defineConfig([ ], plugins: [ typescript({ - tsconfig: './tsconfig.build.json' + tsconfig: './tsconfig.build.json', + compilerOptions: { + sourceMap: sourcemap + } }), del({ targets: ['./lib/*'] }), - isAnalyzeBuild && analyze(), - isDocumentationBuild && command('pnpm typedoc') + Boolean(isAnalyzeBuild) && analyze(), + Boolean(isDocumentationBuild) && command('pnpm typedoc') ] }, { @@ -100,7 +106,7 @@ export default defineConfig([ targets: ['./lib/dts'], hook: 'buildEnd' }), - isAnalyzeBuild && analyze() + Boolean(isAnalyzeBuild) && analyze() ] } ])