build: switch rollup configuration to TS
[poolifier.git] / examples / typescript / websocket-server-pool / ws-cluster / rollup.config.ts
diff --git a/examples/typescript/websocket-server-pool/ws-cluster/rollup.config.ts b/examples/typescript/websocket-server-pool/ws-cluster/rollup.config.ts
new file mode 100644 (file)
index 0000000..ff47fee
--- /dev/null
@@ -0,0 +1,29 @@
+import typescript from '@rollup/plugin-typescript'
+import del from 'rollup-plugin-delete'
+import { defineConfig } from 'rollup'
+
+export default defineConfig({
+  input: ['./src/main.ts', './src/worker.ts'],
+  strictDeprecations: true,
+  output: [
+    {
+      format: 'cjs',
+      dir: './dist',
+      sourcemap: true,
+      entryFileNames: '[name].cjs',
+      chunkFileNames: '[name]-[hash].cjs'
+    },
+    {
+      format: 'esm',
+      dir: './dist',
+      sourcemap: true
+    }
+  ],
+  external: ['node:path', 'node:url', 'poolifier', 'ws'],
+  plugins: [
+    typescript(),
+    del({
+      targets: ['./dist/*']
+    })
+  ]
+})