From 302472d88190665daa8941c1ac9cac30b99186fa Mon Sep 17 00:00:00 2001 From: zlm Date: Wed, 10 Jun 2026 15:43:23 +0800 Subject: [PATCH] refactor: compile backend with tsc, Electron runs dist/index.js --- desktop/src/main.js | 4 ++-- project/package.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/desktop/src/main.js b/desktop/src/main.js index 2e36a1b..3be917d 100644 --- a/desktop/src/main.js +++ b/desktop/src/main.js @@ -4,7 +4,7 @@ const http = require('http') const path = require('path') const PROJECT_DIR = path.resolve(__dirname, '../../project') -const TSX = path.join(PROJECT_DIR, 'node_modules', 'tsx', 'dist', 'cli.mjs') +const ENTRY = path.join(PROJECT_DIR, 'dist', 'index.js') let backend = null let tray = null let isRunning = false @@ -27,7 +27,7 @@ function updateMenu() { function startBackend() { if (backend) return - backend = spawn('node', [TSX, 'src/index.ts'], { + backend = spawn('node', [ENTRY], { cwd: PROJECT_DIR, stdio: 'ignore', env: { ...process.env, PORT: process.env.PORT || '3000' }, diff --git a/project/package.json b/project/package.json index cf0f587..f8a6c00 100644 --- a/project/package.json +++ b/project/package.json @@ -4,7 +4,8 @@ "private": true, "type": "module", "scripts": { - "dev": "tsx watch src/index.ts", + "dev": "tsx src/index.ts", +"watch": "tsx watch src/index.ts", "start": "tsx src/index.ts", "build": "tsc", "build:web": "cd web && npm run build",