fix(pack): esbuild 输入改用绝对路径,支持从任意目录调用
此前 pack.mjs 用相对路径 apps/agent/dist/index.js 作为 esbuild 输入, 从项目目录外调用(node <abs>/scripts/pack.mjs)时报 Could not resolve apps/agent/dist/index.js。 改为基于 __dirname 的绝对路径;README 补充两种调用方式并注明需在项目目录执行。 验证:cd /tmp && node <abs>/scripts/pack.mjs 可正常产出 32MB 安装包
This commit is contained in:
1 parent
52b2c97bdf
commit
4c9b44288c
2 files changed
+14
-2
No files matched your search
@@ -41,7 +41,18 @@ pnpm build
|
||||
|
||||
**方式 A:安装包(推荐,免装 Node.js)**
|
||||
|
||||
1. 在控制端构建安装包:`pnpm pack:win`(产物:`release/nodeagent-win-x64.zip`)
|
||||
1. 在控制端构建安装包(**需在项目目录执行**):
|
||||
|
||||
```bash
|
||||
cd <项目目录> # 例如 ~/WorkBuddy/NodeAgent/nodeagent
|
||||
pnpm pack:win
|
||||
|
||||
# 或从任意目录调用:
|
||||
node <项目目录>/scripts/pack.mjs
|
||||
```
|
||||
|
||||
产物:`release/nodeagent-win-x64.zip`(约 32MB)
|
||||
|
||||
2. 把 zip 拷到 Windows 并解压
|
||||
3. 右键以**管理员**运行其中的 `install.ps1`
|
||||
|
||||
|
||||
+2
-1
@@ -68,7 +68,8 @@ async function main() {
|
||||
execFileSync(
|
||||
esbuild,
|
||||
[
|
||||
'apps/agent/dist/index.js',
|
||||
// 输入用绝对路径,保证从任意工作目录调用都能解析
|
||||
join(root, 'apps', 'agent', 'dist', 'index.js'),
|
||||
'--bundle',
|
||||
'--platform=node',
|
||||
'--target=node22',
|
||||
|
||||
Reference in new issue
Block a user