Skip to content
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

Svelte: component support in bun serve routes #18120

Open
bwright-techkonusa opened this issue Mar 12, 2025 · 0 comments
Open

Svelte: component support in bun serve routes #18120

bwright-techkonusa opened this issue Mar 12, 2025 · 0 comments
Labels
bun:serve Bun.serve and HTTP server enhancement New feature or request

Comments

@bwright-techkonusa
Copy link

What is the problem this feature would solve?

Svelte support in bun serve

It would be useful to be able to directly use svelte components in the bun serve function.
Instead, we have to include a .html and a .ts/.js file for each and use Svelte's mount() method

How it works today

pages/index.svelte

<!-- My Svelte Component -->

pages/index.ts

import { mount } from "svelte";
import index from "./index.svelte";

const root = document.getElementById("root")!;
const app = mount(index, { target: root });

pages/index.html

<html>
  <head>
    <script type="module" src="./index.ts"></script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

app.ts

import { serve } from "bun";
import page1 from './pages/index.html';

serve({
    routes: {
        "/page1": page1,
        ...
    }
});

What is the feature you are proposing to solve the problem?

A more DX-friendly experience

app.ts

import { serve } from "bun";
import page1 from './page1.svelte';
import page2 from './page2.svelte';

serve({
    routes: {
        "/page1": page1,
        "/page2": page2,
    }
});

What alternatives have you considered?

No response

@bwright-techkonusa bwright-techkonusa added the enhancement New feature or request label Mar 12, 2025
@DonIsaac DonIsaac added the bun:serve Bun.serve and HTTP server label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bun:serve Bun.serve and HTTP server enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants