NextJS 15, turbopack and native bun APIs like sql
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Hey everyone,
I'm experimenting with NextJS 15 with turbopack on the bun runtime, and I'm trying to use the bun-native sql (via
I'm starting the nextjs dev server with
I've already tried to bypass node completely by directly running
Is there currently any way to run a dev server (in terms of auto reloading, etc.) for NextJS15 with the bun runtime and Turbopack, and to use bun-native APIs? If I omit the
I'm experimenting with NextJS 15 with turbopack on the bun runtime, and I'm trying to use the bun-native sql (via
import { sql } from "bun", which fails to compile, because the bun-module can not be found, despite @types/bun being installed). I'm starting the nextjs dev server with
bun --bun run dev, to enforce the dev server to run with bun instead of node. In the process tree, I can confirm that indeed bun is used as the runtime for node_modules/next/dist/server/lib/start-server.js, but node is used to run this as a childprocess for node_modules/.bin/next dev --turbopack (so the chain is actually bun --bun run dev ---> node .bin/next dev --turbopack ---> bun node_modules/next/dist/server/lib/start-server.js).I've already tried to bypass node completely by directly running
bun --bun run node_modules/.bin/next dev --turbopack, which does not show any node process in the middle at all, but the bun module is still not found. My guess is that turbopack is hooking node-APIs under the hood, and the bun native APIs are simply not known to turbopack?Is there currently any way to run a dev server (in terms of auto reloading, etc.) for NextJS15 with the bun runtime and Turbopack, and to use bun-native APIs? If I omit the
--turbopack option, I am able to use bun-native APIs without any errors.