Merge pull request #1129 from poolifier/chore/use-biome
[poolifier.git] / rollup.config.mjs
index b1386fbdd0dea8c352c0dad28b9dac9e309be252..9e8cd65bb0317152141a539de08f8d64c16a2c6c 100644 (file)
@@ -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()
     ]
   }
-]
+])