X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=9e8cd65bb0317152141a539de08f8d64c16a2c6c;hb=660689f017615c233020793967822c31975e5aa0;hp=b1386fbdd0dea8c352c0dad28b9dac9e309be252;hpb=ef12e3d5976fb64f383bca2e42932669b9fb5f3c;p=poolifier.git diff --git a/rollup.config.mjs b/rollup.config.mjs index b1386fbd..9e8cd65b 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -5,6 +5,7 @@ import typescript from '@rollup/plugin-typescript' import analyze from 'rollup-plugin-analyzer' import command from 'rollup-plugin-command' import del from 'rollup-plugin-delete' +import { defineConfig } from 'rollup' const availableParallelism = () => { let availableParallelism = 1 @@ -25,35 +26,36 @@ const isDocumentationBuild = process.env.DOCUMENTATION const maxWorkers = Math.floor(availableParallelism() / 2) -export default [ +export default defineConfig([ { - input: 'src/index.ts', + input: './src/index.ts', strictDeprecations: true, output: [ { format: 'cjs', ...(isDevelopmentBuild && { - dir: 'lib', + dir: './lib', sourcemap: true, preserveModules: true, - preserveModulesRoot: 'src' + preserveModulesRoot: './src' }), ...(!isDevelopmentBuild && { - file: 'lib/index.js', + file: './lib/index.js', plugins: [terser({ maxWorkers })] }) }, { format: 'esm', ...(isDevelopmentBuild && { - dir: 'lib', + dir: './lib', sourcemap: true, entryFileNames: '[name].mjs', + chunkFileNames: '[name]-[hash].mjs', preserveModules: true, - preserveModulesRoot: 'src' + preserveModulesRoot: './src' }), ...(!isDevelopmentBuild && { - file: 'lib/index.mjs', + file: './lib/index.mjs', plugins: [terser({ maxWorkers })] }) } @@ -71,11 +73,11 @@ export default [ plugins: [ typescript({ tsconfig: isDevelopmentBuild - ? 'tsconfig.development.json' - : 'tsconfig.production.json' + ? './tsconfig.development.json' + : './tsconfig.production.json' }), del({ - targets: ['lib/*'] + targets: ['./lib/*'] }), isAnalyzeBuild && analyze(), isDocumentationBuild && command('pnpm typedoc') @@ -83,7 +85,7 @@ export default [ }, { input: './lib/dts/index.d.ts', - output: [{ format: 'esm', file: 'lib/index.d.ts' }], + output: [{ format: 'esm', file: './lib/index.d.ts' }], external: [ 'node:async_hooks', 'node:cluster', @@ -94,10 +96,10 @@ export default [ plugins: [ dts(), del({ - targets: ['lib/dts'], + targets: ['./lib/dts'], hook: 'buildEnd' }), isAnalyzeBuild && analyze() ] } -] +])