Skip to content

bun index.html doesn't expose on network #25335

@jakeg

Description

@jakeg

Run bun server.js with these 2 files in a folder:

server.js:

import home from './index.html'
let server = Bun.serve({ routes: { '/': home } })
console.log(`Server at ${server.url}`)

index.html:

<!doctype html>
<title>Hi</title>
hello world

... and the server is accessible on both localhost and over the network by IP address.

But run bun index.html and the server is only accessible on localhost.

Shouldn't bun index.html automatically be exposed over the network as per if running a .js file? This behaviour seems inconsistent if not.

Workaround: bun index.html --host=:3000 works, but annoying to have to add --host=:3000 when you don't need that for bun server.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions