fix: Update leptos template so that it works OOTB
The current leptos template does not work out of the box due to an issue with wasm-bindgen. This PR returns it to a working state via a workaround discussed in the below linked issue by:
- Bumping workers-rs to 0.6 in Cargo.toml
- Disabling wasm-opt
- Adding a call to
pub(super) fn __wasm_call_ctors(); - Adding a
startfn to lib.rs
Resolves #772
Thanks for fixing this, although I believe the wasm-bindgen issue has now been fixed upstream with https://github.com/wasm-bindgen/wasm-bindgen/pull/4562.
So the question then is if we still need this if that fix goes out this week and we can release to that?
I would at least like to check the root cause has been fixed upstream as well.
Also - we need to figure out the testing story here, as not realising when templates break is not ideal...
Well, FWIW, the template was still failing for me even after that PR was merged, but I haven’t tried it again since I submitted this so I guess it’s possible that it just works now? I may be able to set aside some time tomorrow afternoon to test if you don’t get to it by then.
Strong agree that testing would be really good, but given the failure point here was an outside library it feels like the only way to really know if it works is to build a new project from the template and see if it compiles. Maybe something in the CI can just do this?
edit: mobile GitHub is hard to use and I misread your comment haha. I see now that you’re saying the fix will go out soonish.
I still think this should get merged even if it isn’t needed next week, because the experience for me trying to get this working was super frustrating and I’d like to spare a couple of people that if possible.
@natecox note that wasm-bindgen has not yet been released since that landed, I expect the next release should be in the coming days though or early next week with some luck. Will update here if you're interested in investigating further then.
Ah, I suspect you started responding before I added an edit to my comment above; just making sure you see it because it’s relevant.
The latest version has now been landed in https://github.com/cloudflare/workers-rs/pull/800.