workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[BUG] leptos template fails with `/pkg/.js` not found

Open Gentoli opened this issue 8 months ago • 2 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

What version of workers-rs are you using?

0.7.5

What version of wrangler are you using?

4.76.0

Describe the bug

Fails with GET /pkg/.js 404 Not Found

...
[custom build] 
⎔ Starting local server...
[wrangler:info] Ready on http://localhost:8787
[wrangler:info] GET / 200 OK (75ms)
[wrangler:info] GET /pkg/.js 404 Not Found (7ms)
[wrangler:info] GET /pkg/<my-pkg>.css 200 OK (18ms)
[wrangler:info] GET /pkg/_bg.wasm 404 Not Found (14ms)
[wrangler:info] GET /favicon.ico 200 OK (3ms)

Browser console:

Loading module from “http://localhost:8787/pkg/.js” was blocked because of a disallowed MIME type (“”).

Steps To Reproduce

  1. cargo generate with templates/leptos (nightly=true)
  2. run either npx wrangler dev or npx wrangler deploy
  3. navigate to site (GET /pkg/.js 404)
  4. button do not work

Gentoli avatar Mar 21 '26 19:03 Gentoli

I think it’s this change that broke the paths. Without it, the template works correctly.

@Sushi-Mampfer, what was the rationale for it?

jakubadamw avatar Mar 22 '26 14:03 jakubadamw

I think it’s this change that broke the paths. Without it, the template works correctly.

@Sushi-Mampfer, what was the rationale for it?

I didn't throughly test the change, I couldn't find any reference to the env in the code and on my test project I still had the env set and the template compiles without it. On windows the syntax for setting the env isn't valid, and because I thought it served no purpose I removed it. I can make a pr with a fix that works for unix and windows(it would require another question when using the template) or the commit could be reverted(which won't work out of the box for windows).

Sushi-Mampfer avatar Mar 22 '26 17:03 Sushi-Mampfer