是否可以让 Bun 将我的 TypeScript 捆绑到保存在 VS Code 中的文件中?

问题描述 投票:0回答:1

是否可以让 Bun 将我的 TypeScript 捆绑到保存在 VS Code 中的文件中?

guide说我可以在命令行中调用

bun run index.ts
并将其添加到
package.json
像这样,但我不知道如何让它在保存时运行。

{
  "name": "quickstart",
  "module": "index.ts",
  "type": "module",
  "scripts": {
    "start": "bun run index.ts"
  },
  "devDependencies": {
    "@types/bun": "^1.0.0"
  }
}
typescript visual-studio-code bun
1个回答
0
投票

阅读来源:https://www.sitepoint.com/community/t/running-npm-command-on-file-save/321619

您也许可以使用以下内容:https://www.npmjs.com/package/npm-watch

  "watch": {
    "start": "{src,test}/*.ts"
  },
  "scripts": {
    "start": "bun run index.ts"
  },
© www.soinside.com 2019 - 2024. All rights reserved.