Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bun): resolve internal dependencies with bun export condition #1313

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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