build: switch rollup configuration to TS
[poolifier.git] / examples / typescript / websocket-server-pool / ws-hybrid / rollup.config.ts
diff --git a/examples/typescript/websocket-server-pool/ws-hybrid/rollup.config.ts b/examples/typescript/websocket-server-pool/ws-hybrid/rollup.config.ts
new file mode 100644 (file)
index 0000000..6d2fc34
--- /dev/null
@@ -0,0 +1,33 @@
+import typescript from '@rollup/plugin-typescript'
+import del from 'rollup-plugin-delete'
+import { defineConfig } from 'rollup'
+
+export default defineConfig({
+  input: [
+    './src/main.ts',
+    './src/websocket-server-worker.ts',
+    './src/request-handler-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/*']
+    })
+  ]
+})