thaw-ui / thaw

An easy to use leptos component library
https://thawui.vercel.app
MIT License
209 stars 23 forks source link

Frontend compile error with --features=hydrate (Spin app) #142

Closed vascokk closed 3 months ago

vascokk commented 3 months ago
Finished `release` profile [optimized] target(s) in 1.61s
   Cargo finished cargo build --package=app --lib --target-dir=<path-to-my-project>/app/target/front --target=wasm32-unknown-unknown --no-default-features --features=hydrate --release
   Front compiling WASM
 Compiling thaw v0.2.3

error[E0432]: unresolved import `leptos::leptos_dom::Mountable`
  --> /Users/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thaw-0.2.3/src/mobile/toast/mod.rs:13:22
   |
13 |         use leptos::{leptos_dom::Mountable, *};
   |                      ^^^^^^^^^^^^^^^^^^^^^ no `Mountable` in the root
   |
note: found an item that was configured out
  --> /Users/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos_dom-0.6.9/src/lib.rs:78:11
   |
78 | pub trait Mountable {
   |           ^^^^^^^^^

error[E0599]: no method named `get_mountable_node` found for enum `leptos::View` in the current scope
  --> /Users/<user>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thaw-0.2.3/src/mobile/toast/mod.rs:17:25
   |
17 |         let node = node.get_mountable_node();
   |                         ^^^^^^^^^^^^^^^^^^ method not found in `View`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `thaw` (lib) due to 2 previous errors
Error: Failed to build app

My Cargo.toml:

[dependencies]
anyhow = "1"
cfg-if = "1"
console_error_panic_hook = "0.1"
http = "1.0"
leptos = "0.6.9"
leptos_integration_utils = { version = "0.6.9", optional = true }
leptos_meta = "0.6.9"
leptos_router = "0.6.9"
leptos_reactive = "0.6.9"
leptos-spin = { version = "0.1.0", optional = true }
log = "0.4.21"
serde = "1.0"
spin-sdk = { version = "2.2", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
rust_decimal = "1.34.3"
countries = { version = "0.1.3", features = ["flags", "serde", "async-graphql"] }

thaw = { version = "0.2.3", default-features = false}

[workspace]

[features]
csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr", "thaw/csr"]
hydrate = [
  "leptos/hydrate",
  "leptos_meta/hydrate",
  "leptos_router/hydrate",
  "leptos_reactive/hydrate",
  "dep:wasm-bindgen",
  "thaw/hydrate",
]
ssr = [
  "leptos/ssr",
  "leptos_meta/ssr",
  "leptos_router/ssr",
  "leptos/spin",
  "dep:spin-sdk",
  "dep:leptos-spin",
  "dep:leptos_integration_utils",
  "thaw/ssr"
]

[profile.wasm-release]
inherits = "release"
opt-level = 'z'
lto = true
codegen-units = 1
panic = "abort"

[package.metadata.leptos]
assets-dir = "public"

# Mandatory fields for Spin apps
bin-target-triple = "wasm32-wasi"
bin-features = ["ssr"]
bin-default-features = false
lib-features = ["hydrate"]
lib-default-features = false
luoxiaozero commented 3 months ago

I fixed it at #144.