Replies: 1 comment
|
Your separation is the right model, with one current limitation: Vite+ manages Node as the JavaScript tool runtime and treats Bun as a separate package-manager/direct-command shim. There is no Vite+ setting that changes the built-in Vite or Vitest process into a Bun process. For a Vite frontend plus Bun backend, make Bun explicit in project scripts: {
"packageManager": "bun@1.x",
"scripts": {
"dev:api": "bun --watch src/server.ts",
"test:bun": "bun test"
}
}Run those with: vp run dev:api
vp run test:bunThen run export default defineConfig({
server: {
proxy: {
'/api': 'http://localhost:3000',
},
},
})The distinction matters for tests: If the whole framework development command must run under Bun, put that command in This separation is reflected in the environment documentation, built-in commands versus project scripts, and the current Node-only runtime implementation. |
Uh oh!
There was an error while loading. Please reload this page.
I really like the toolchain provided by Vite+ and don't want to let it go, but I also really like some of the runtime features provided by Bun, and additionally there are some frameworks and libraries that only run on Bun. There is no explicit support for this in Vite+ since it is intended to run with the
vp env-managed Node version. The only documented support is Bun as the package manager, which is not what I'm talking about here.After giving it some thought, I don't really see anything preventing the use of Vite+ and Bun's runtime together. Vite+ is a development toolchain, and an app's runtime is inherently separate from that. I'm even ok with Vite+ using Node internally to run all of its contained tools (i.e. run Vite, Oxfmt, Oxlint with managed Node), I just need the application code to be able to use Bun APIs. I want to know what configuration I need to be aware of to make sure that Vite's dev server can interact with a separate Bun process for the actual app.
One potential issue here that I'm aware of is testing.
vp testwould use Vitest running on managed Node, but the actual app code under test expects a Bun runtime. A few ways I can think of to resolve that:bun testfor this caseIn a perfect world, it would be really nice if Vite+ had first-class support for managing and running on Node-compatible runtimes like Bun and Deno. I recognize that there are more pressing features though.
All reactions