build: add one-command dev launcher
scripts/dev.sh checks toolchains and ports, installs frontend deps when the lockfile changes, starts the Go server and Vite with prefixed logs, and stops both on Ctrl+C or when either exits. The Vite proxy reads the same API_PORT so custom ports keep working.
This commit is contained in:
1 parent
dc7e43bc3c
commit
b3f05b501a
3 files changed
+99
-9
No files matched your search
+2
-2
@@ -11,8 +11,8 @@ export default defineConfig({
|
||||
},
|
||||
worker: { format: 'es' },
|
||||
server: {
|
||||
// 开发时把 API 与 WebSocket 转发给本地 Go 服务
|
||||
proxy: { '/api': { target: 'http://127.0.0.1:8080', ws: true } },
|
||||
// 开发时把 API 与 WebSocket 转发给本地 Go 服务(端口与 scripts/dev.sh 的 API_PORT 一致)
|
||||
proxy: { '/api': { target: `http://127.0.0.1:${process.env.API_PORT ?? 8080}`, ws: true } },
|
||||
},
|
||||
test: { environment: 'node' },
|
||||
})
|
||||
Reference in new issue
Block a user