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.
19 lines
621 B
TypeScript
19 lines
621 B
TypeScript
import vue from '@vitejs/plugin-vue'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
build: {
|
|
rolldownOptions: {
|
|
// demo.html 为免登录的编辑器演示页,供自动化性能/交互测试使用
|
|
input: { index: 'index.html', demo: 'demo.html' },
|
|
},
|
|
},
|
|
worker: { format: 'es' },
|
|
server: {
|
|
// 开发时把 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' },
|
|
})
|