Skip to content

bun build --compile doesn't work for sveltekit apps #15734

Description

@opensas

What version of Bun is running?

1.1.38

What platform is your computer?

Linux 6.8.0-49-generic x86_64 x86_64

What steps can reproduce the bug?

reference docs:

$ bunx sv create sveltekit-bun-app

┌  Welcome to the Svelte CLI! (v0.6.7)
│
◇  Which template would you like?
│  SvelteKit demo
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  none
│
◇  Which package manager do you want to install dependencies with?
│  bun

$ cd sveltekit-bun-app

$ bun dev --open

this works ok, then

$ bun add -D svelte-adapter-bun

update svelte.config.js

// import adapter from "@sveltejs/adapter-auto";
import adapter from "svelte-adapter-bun";

create build

$ bun --bun run build

test build

$ bun --bun build/index.js

works ok

compile app

$ bun build build/index.js --compile --outfile bun-server
  [34ms]  bundle  32 modules
  [99ms] compile  bun-server

$ ll -h bun-server
-rwxrwxrwx 1 sas sas 93M Dec 12 12:43 bun-server*

execute it

$ ./bun-server
Listening on 0.0.0.0:3000

assets cannot be found

Image

console output:

$ ./bun-server 
Listening on 0.0.0.0:3000
error: Not found: /
      at new SvelteKitError (/$bunfs/root/bun-server:992:7)
      at /$bunfs/root/bun-server:18538:18
      at resolve2 (/$bunfs/root/bun-server:18449:29)
      at resolve (/$bunfs/root/bun-server:18396:42)
      at /$bunfs/root/bun-server:18394:49

error: Not found: /favicon.png
      at new SvelteKitError (/$bunfs/root/bun-server:992:7)
      at /$bunfs/root/bun-server:18538:18
      at resolve2 (/$bunfs/root/bun-server:18449:29)
      at resolve (/$bunfs/root/bun-server:18396:42)
      at /$bunfs/root/bun-server:18394:49

What is the expected behavior?

the app to work ok

What do you see instead?

the pasted screenshot

Additional information

same issue happens with deno: denoland/deno#26155 (comment)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbundlerSomething to do with the bundlerecosystemSomething that relates to package or framework compatibilitysingle-file-executablebun build --compile

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions