From a1db975800f3dae15f2d43e97384cccede1ef5ea Mon Sep 17 00:00:00 2001 From: Craig Beck Date: Wed, 15 May 2024 16:44:26 -0700 Subject: [PATCH 1/2] Add Node16 compatible path mapping for derby/dist/server --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 510dfb6e..d38e5f46 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "./App": "./dist/App.js", "./AppForServer": "./dist/AppForServer.js", "./server": "./dist/server.js", + "./dist/server": "./dist/server.js", "./Page": "./dist/Page.js", "./test-utils": "./dist/test-utils/index.js", "./test-utils/*": "./dist/test-utils/*.js", From 085bf0dd4c62ea622ff4645b29034ac622e4e9c3 Mon Sep 17 00:00:00 2001 From: Craig Beck Date: Wed, 15 May 2024 16:45:11 -0700 Subject: [PATCH 2/2] Import cluster as namespace to avoid transformed default import which does not work --- src/server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index d5761d0f..83859de3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,10 +1,12 @@ -import cluster from 'cluster'; +// import as namespace to avoid transform as cluster.default +import * as cluster from 'node:cluster'; const isProduction = process.env.NODE_ENV === 'production'; export function run(createServer: () => void) { // In production if (isProduction) return createServer(); + // @ts-expect-error imported without default; need type update? if (cluster.isPrimary) { console.log('Primary PID ', process.pid); startWorker(); @@ -14,6 +16,7 @@ export function run(createServer: () => void) { } function startWorker() { + // @ts-expect-error imported without default; need type update? const worker = cluster.fork(); worker.once('disconnect', function () {