We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 620092c commit fb964deCopy full SHA for fb964de
src/index.ts
@@ -1,6 +1,7 @@
1
import type { Scope } from 'harperdb';
2
import { join } from 'node:path';
3
import * as vite from 'vite';
4
+import { parentPort } from 'node:worker_threads';
5
6
export const viteWrapper = {
7
createServer: vite.createServer,
@@ -20,4 +21,12 @@ export async function handleApplication(scope: Scope) {
20
21
}
22
23
scope.on('close', () => viteInstance.close());
24
+
25
+ // TODO: Once `scope.close` is emitting properly, we won't need this. Hopefully.
26
+ // To you who read this in 2 years and shake your head: I salute you, sir or madam.
27
+ parentPort?.on('message', (msg) => {
28
+ if (msg.type === 'shutdown') {
29
+ viteInstance.close();
30
+ }
31
+ });
32
0 commit comments