Bun:找不到模块“./lib/decorators/timed”

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

我在捆绑 Bun 应用程序时遇到问题。它使用 Hono 和 WebSockets,并在开发运行时完美运行,但在使用 un build 构建它后,我在运行它时遇到了问题。我收到错误消息:

Cannot find module "./lib/decorators/timed" from "/Users/b/codebases/az/mdlr/api/.api/index.js"

这是我的 package-json:

{
  "scripts": {
    "api:local": "dotenv -e .env.local -- bun run --hot --watch index.ts",
    "api:prod": "dotenv -e .env.prod -- bun run --hot index.ts",
    "api:build": "dotenv -e .env.local -- bun build index.ts --outdir .api --target bun",
    "api:start": "bun run .api/index.js",
    "api:tsc": "tsc",
    "api:lint": "eslint . --ext .ts,.tsx",
    "api:lint:fix": "eslint . --ext .ts,.tsx --fix",
    "api:unimported": "unimported",
    "api:knip": "knip"
  },
  "dependencies": {
    "cheerio": "^1.0.0-rc.12",
    "dotenv": "^16.4.5",
    "eslint": "^8.57.0",
    "firebase-admin": "^11.11.1",
    "hono": "^4.3.4",
    "moment": "^2.30.1",
    "mongoose": "^8.3.4",
    "slack-node": "^0.1.8",
    "stripe": "^14.23.0",
    "xml2js": "^0.6.2",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@types/bun": "^1.1.3",
    "@types/slack-node": "^0.1.7",
    "@types/stripe": "^8.0.417",
    "@types/xml2js": "^0.4.14",
    "@typescript-eslint/eslint-plugin": "^7.10.0",
    "@typescript-eslint/parser": "^7.10.0",
    "dotenv-cli": "^4.0.0",
    "knip": "^5.16.0",
    "unimported": "^1.31.1"
  }
}
  1. 我尝试清理所有内容并安装包
  2. 我尝试更改文件夹名称或类似实验
bun
1个回答
0
投票

所以问题是 slack-node 包,它包含 when 包,当捆绑时有一些 Bun 无法处理的引用。

软件包及其依赖项列表

© www.soinside.com 2019 - 2024. All rights reserved.