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

Bun Dev Server CSS reload is broken #1143

Open
vorburger opened this issue Mar 1, 2025 · 4 comments
Open

Bun Dev Server CSS reload is broken #1143

vorburger opened this issue Mar 1, 2025 · 4 comments
Labels
bug Something isn't working contributors Affects Contributors (not users) help wanted Extra attention is needed UI Web UI

Comments

@vorburger
Copy link
Member

vorburger commented Mar 1, 2025

I'd like to use the cool new (v1.2.3) magic Hot Reloading (!) Bun Dev Server in this project.

If you clone this repo, git checkout 957d52d2109d9c22665eb4ddc7a4bd26a455f55e, and cd web, then:

bun public/index.html doesn't quite work (because Bun doesn't [can't?] know about the public/demo/greeting3.gexf.

bun public/**/*.* fails with:

1 | <?xml version="1.0" encoding="UTF-8"?>
     ^
error: Expected JSX element name but found "?"
    at /home/vorburger/git/github.com/enola-dev/enola/web/public/demo/greeting3.gexf:1:2

Bun v1.2.4 (Linux x64)

because Bun doesn't dig what a *.gexf is - OK, fair enough! 😆 (Although... shouldn't it perhaps better just "pass through" any unknown file ypes?!)

But, of course, this project already has a Bun Dev Server launch script in web/src/bun/develop.ts...

... and that still "just works" - at least it starts, and on http://localhost:7070 the graph is there! But that Hot Reloading is broken... 😿 If I change something in public/demo/index.html, then this appears:

Runtime Error error: Failed to resolve dynamic import 'public/enola.css'. With Bun's DevServer, all imports must be statically known at build time so that the bundler can trace everything.

It's not clear to me if the CSS has to added to serve()? Is this supposed to magically "just work", based on the <link rel="stylesheet" href="enola.css" /> in the public/demo/index.html?

@edewit I don't suppose you know how to fix this?

@vorburger
Copy link
Member Author

@vorburger vorburger added bug Something isn't working UI Web UI contributors Affects Contributors (not users) help wanted Extra attention is needed labels Mar 1, 2025
vorburger added a commit to vorburger/bun that referenced this issue Mar 1, 2025
This is useful when hot reload doesn't quite work just yet, e.g. in the case of what I'm hitting in enola-dev/enola#1143 (any help & tips on that would be very welcome BTW).
@vorburger
Copy link
Member Author

#1144 disables hot reload with development: { hmr: false }, for now (I'll need to remember to re-active it once a solution for the CSS resolution error above is found).

@vorburger
Copy link
Member Author

bun upgrade --canary to bump Bun 1.2.4 to (presumably a nightly of) 1.2.5 does not help.

@vorburger
Copy link
Member Author

oven-sh/bun#17854 now raised about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contributors Affects Contributors (not users) help wanted Extra attention is needed UI Web UI
Projects
None yet
Development

No branches or pull requests

1 participant