headless-studio / leptos-leaflet

MIT License
22 stars 14 forks source link

Note on using "serde-serialize" feature of wasm-bindgen instead of serde-wasm-bindgen #24

Closed Wollaston closed 4 months ago

Wollaston commented 4 months ago

Hi all,

First, thanks for the cool crate. I have been enjoying experimenting with it in a few of my projects.

An issue I came across is that depending on other project dependencies, using the wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } can cause a "cyclic package dependency" and prevent the project from building (the getrandom crate ends up depending on itself). I did some research on this issue in the Rust Wasm context, and this can be caused by using that serde-deserialize feature of wasm-bindgen. Removing that feature and instead using the serde-wasm-bindgen crate in its place resolves this issue. Making this update on a local branch let my project compile and run without issue. I also tested the leptos-leaflet project examples with this change, and they also seem to run just fine.

Here is some discussion on this issue that helped me resolve it:

I make this issue as the update is not strictly required, but it can lead to a bit of confusion as it comes up depending on the other project dependencies without too much help from the standard Cargo error messages.

I can make a pull request correcting the Cargo.toml for the main library if that would be helpful. Otherwise, anyone else who comes across this issue can make the update locally or in a fork and resolve the issue that way. Thank you again.

dgsantana commented 4 months ago

Ok, thanks for finding the issue, and I'm glad you are enjoying the crate.

Feel free to make a pull request to fix the Cargo.toml.