mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-25 17:54:34 +08:00
fix(cli): resolve ESM module resolution for tsx dev mode
- Remove "type": "module" from apps/cli/package.json to avoid ESM/CJS interop issues with workspace packages in tsx dev mode - Configure tsup to output .mjs files (always treated as ESM by Node.js) - Rename bin entry from chatlab.js to chatlab.mjs - Change chatlab web default port to 3100 (serve keeps 3110) - Fix vite plugin: use pnpm instead of npx for tsx invocation
This commit is contained in:
1 parent
e363e8bd75
commit
0aa30359ab
5 files changed
+8
-8
No files matched your search
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
import('../dist/cli.js').then((m) => m.run())
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
import('../dist/cli.mjs').then((m) => m.run())
|
||||
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "chatlab-cli",
|
||||
"version": "0.1.0",
|
||||
"description": "ChatLab CLI & Service - 聊天记录分析工具",
|
||||
"type": "module",
|
||||
"description": "ChatLab CLI & Service - Chat history analysis tool",
|
||||
"bin": {
|
||||
"chatlab": "./bin/chatlab.js"
|
||||
"chatlab": "./bin/chatlab.mjs"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/index.mjs",
|
||||
"files": [
|
||||
"bin/",
|
||||
"dist/",
|
||||
|
||||
@@ -7,6 +7,7 @@ export default defineConfig({
|
||||
},
|
||||
format: ['esm'],
|
||||
outDir: 'dist',
|
||||
outExtension: () => ({ js: '.mjs' }),
|
||||
splitting: true,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ function chatlabServePlugin(): Plugin {
|
||||
|
||||
const inUse = await isPortInUse(BACKEND_PORT)
|
||||
if (inUse) {
|
||||
console.log(`[chatlab serve] 端口 ${BACKEND_PORT} 已在使用中,跳过启动`)
|
||||
console.log(`[chatlab serve] Port ${BACKEND_PORT} already in use, skipping`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ function chatlabServePlugin(): Plugin {
|
||||
const coreDir = resolve(__dirname, 'packages/core/src')
|
||||
const runtimeDir = resolve(__dirname, 'packages/node-runtime/src')
|
||||
serverProcess = spawn(
|
||||
'npx',
|
||||
'pnpm',
|
||||
[
|
||||
'tsx',
|
||||
'watch',
|
||||
|
||||
Reference in new issue
Block a user