Skip to content

Commit

Permalink
fix(bun): resolve internal dependencies with bun export condition (#…
Browse files Browse the repository at this point in the history
…1313)

* chore: increase timeout

* resolve with `bun` condition
  • Loading branch information
pi0 authored Jun 16, 2023
1 parent 02e81de commit c24e1f8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"source-map-support": "^0.5.21",
"std-env": "^3.3.3",
"ufo": "^1.1.2",
"uncrypto": "^0.1.3",
"unenv": "^1.5.1",
"unimport": "^3.0.8",
"unstorage": "^1.6.1"
Expand Down
51 changes: 27 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/presets/bun.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { resolvePathSync } from "mlly";
import { defineNitroPreset } from "../preset";

export const bun = defineNitroPreset({
extends: "node-server",
entry: "#internal/nitro/entries/bun",
externals: {
traceInclude: ["ofetch", "uncrypto", "node-fetch-native"].map((id) =>
resolvePathSync(id, {
url: import.meta.url,
conditions: ["bun"],
})
),
},
commands: {
preview: "bun run ./server/index.mjs",
},
Expand Down
2 changes: 1 addition & 1 deletion test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function testNitro(

beforeAll(async () => {
_handler = await getHandler();
});
}, 5000);

it("API Works", async () => {
const { data: helloData } = await callHandler({ url: "/api/hello" });
Expand Down

0 comments on commit c24e1f8

Please sign in to comment.