-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Mark Bun built-ins as external #3398
base: main
Are you sure you want to change the base?
Conversation
I'm not sure this specific direction (adding bun-specific stuff to esbuild's node target) makes sense because that target is for node, not bun. |
Bun is intended as a drop-in replacement for Node, so if anything in the |
Any update on this? Or does anyone have workarounds? |
I'm not sure if this will work for you, but FYI esbuild already has an API to mark things as external: https://esbuild.github.io/api/#external. Specifically |
Users of various Vite-based frameworks have been hitting module resolution errors when trying Bun's built-in modules like
bun:sqlite
. These frameworks generally rely on esbuild's default behavior of marking Node.js built-ins as external & side-effect-free. This PR does the same for Bun's built-ins:bun:*
modules andbun
itself.Happy to update this to explicitly list each Bun builtin:
bun:test
,bun:ffi
,bun:sqlite
, etc. But we'll likely update this list several times in the future and I was worried about maintainence burden for esbuild. So currently this PR just checks for thebun:
prefix. Unlike Node.js, Bun requires usage of thebun:
prefix for its built-in modules.Some of the issues this fixes
bun:sqlite
package. withastro/astro#8476bun:*
packages vitejs/vite#14351