X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=b1197e910e1cc524ab56265fd436579dbee6914f;hb=710826bc287a006d90f9cdda42fdbac655757973;hp=2b0ec5dbc17879c8e9fc2ac627b104cdda492ac0;hpb=61a90f2e524662cc63d46f0a0ffbe599b1ac44b5;p=poolifier.git diff --git a/rollup.config.mjs b/rollup.config.mjs index 2b0ec5db..b1197e91 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,9 +1,8 @@ -import ts from 'rollup-plugin-ts' +import terser from '@rollup/plugin-terser' +import typescript from '@rollup/plugin-typescript' import analyze from 'rollup-plugin-analyzer' -import { terser } from 'rollup-plugin-terser' -import del from 'rollup-plugin-delete' import command from 'rollup-plugin-command' -import istanbul from 'rollup-plugin-istanbul' +import del from 'rollup-plugin-delete' const isDevelopmentBuild = process.env.BUILD === 'development' const isAnalyze = process.env.ANALYZE @@ -11,23 +10,38 @@ const isDocumentation = process.env.DOCUMENTATION export default { input: 'src/index.ts', - output: { - ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }), - format: 'cjs', - sourcemap: !!isDevelopmentBuild, - ...(isDevelopmentBuild && { preserveModules: true }), - ...(isDevelopmentBuild && { preserveModulesRoot: 'src' }), - ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] }) - }, - external: ['async_hooks', 'cluster', 'events', 'worker_threads'], + strictDeprecations: true, + output: [ + { + ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }), + format: 'cjs', + sourcemap: !!isDevelopmentBuild, + ...(isDevelopmentBuild && { + preserveModules: true, + preserveModulesRoot: 'src' + }), + ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + }, + { + ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.mjs' }), + format: 'esm', + sourcemap: !!isDevelopmentBuild, + + ...(isDevelopmentBuild && { + entryFileNames: '[name].mjs', + preserveModules: true, + preserveModulesRoot: 'src' + }), + ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + } + ], + external: ['async_hooks', 'cluster', 'events', 'os', 'worker_threads'], plugins: [ - ts({ + typescript({ tsconfig: isDevelopmentBuild ? 'tsconfig.development.json' - : 'tsconfig.json', - browserslist: false + : 'tsconfig.production.json' }), - isDevelopmentBuild && istanbul(), del({ targets: ['lib/*'] }),