From: Jérôme Benoit Date: Sun, 28 May 2023 11:11:46 +0000 (+0200) Subject: build: refactor build options handling X-Git-Tag: v2.5.0~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5119cf1a3864eaadb079ae68df6d4dae1a52b2cb;p=poolifier.git build: refactor build options handling Signed-off-by: Jérôme Benoit --- diff --git a/rollup.config.mjs b/rollup.config.mjs index 02fc54c0..99f833b4 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -13,25 +13,31 @@ export default { strictDeprecations: true, output: [ { - ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }), format: 'cjs', sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { + dir: 'lib', preserveModules: true, preserveModulesRoot: 'src' }), - ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + ...(!isDevelopmentBuild && { + file: 'lib/index.js', + plugins: [terser({ maxWorkers: 2 })] + }) }, { - ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.mjs' }), format: 'esm', sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { + dir: 'lib', entryFileNames: '[name].mjs', preserveModules: true, preserveModulesRoot: 'src' }), - ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + ...(!isDevelopmentBuild && { + file: 'lib/index.mjs', + plugins: [terser({ maxWorkers: 2 })] + }) } ], external: [