chore(web): 将项目切换到ESM模块系统

将项目从CommonJS切换到ESM模块系统,更新了`dev:server`和`db:init`脚本以使用`node --import tsx/esm`模式,并在`package.json`中添加了`"type": "module"`配置。
This commit is contained in:
2026-05-08 01:43:49 +08:00
parent a6f2973f21
commit 2db7f316f2

View File

@@ -4,10 +4,10 @@
"private": true,
"scripts": {
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
"dev:server": "npx kill-port 3007 && tsx watch server/index.ts",
"dev:server": "npx kill-port 3007 && node --import tsx/esm --watch server/index.ts",
"dev:client": "cd client && npm run dev",
"build": "cd client && npm run build",
"db:init": "tsx server/db/schema.ts",
"db:init": "node --import tsx/esm server/db/schema.ts",
"setup": "npm install && cd client && npm install"
},
"dependencies": {
@@ -31,5 +31,6 @@
"kill-port": "^2.0.1",
"tsx": "^4.19.0",
"typescript": "^5.6.0"
}
},
"type": "module"
}