Bun JavaScript 运行时与工具链
bun 集运行时、包管理器、测试器和打包器于一体,追求速度和 Node.js 兼容。它适合新项目和脚本,但生产使用前要验证依赖兼容性。
bun --version
bun run app.ts
bun app.ts
bun --watch app.ts
bun install
bun add express
bun add -d typescript
bun remove express
bun test
bunx cowsay hello
bun build ./src/index.ts --outdir dist
bun build --compile ./app.ts --outfile app
bun init
bun install 生成的 lockfile 与 npm/pnpm 不同;团队要统一工具。bunx 会下载并执行包;版本要固定,避免供应链风险。--compile 产物包含运行时,体积和平台相关性要提前评估。合上页面,先回答,再展开对照。
bun install 生成的 lockfile 与 npm/pnpm 的关系是什么?bun build --compile 的产物有什么需要提前评估的特点?
小程序版
微信扫码,随时查命令