-
Notifications
You must be signed in to change notification settings - Fork 115
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
Custom lib name fails to resolve during build. #415
Comments
This makes it impossible to use a different name for the lib than for the bin, which makes it very annoying on Windows due to a very verbose filename collision warning when bin and lib have the same name:
|
Hi, think I'm facing the same issue. Suppose my package is set up like this: [package]
name = "web"
version = { workspace = true }
edition = { workspace = true }
authors = { workspace = true }
[[bin]]
name = "web_ssr"
path = "src/bin/ssr.rs"
required-features = ["ssr"]
[[bin]]
name = "web_csr"
path = "src/bin/csr.rs"
required-features = ["csr"]
[lib]
name = "web_app"
crate-type = ["cdylib", "rlib"]
[dependencies]
bevy = { workspace = true, optional = true, default-features = false, features = [
"webgl2",
] }
console_error_panic_hook = "0.1"
cfg-if = "1"
leptos = { version = "0.7.5", features = ["nightly"] }
leptos-bevy-canvas = { version = "0.1.0", optional = true }
leptos-use = "0.15.1"
leptos_meta = { version = "0.7.5" }
leptos_router = { version = "0.7.5" }
leptos_wasi = { version = "0.1.3", optional = true }
spin-sdk = { version = "3", optional = true }
# spin pathc
wasi = { version = "=0.13.2", optional = true }
wasm-bindgen = { version = "=0.2.100", optional = true }
[package.metadata.leptos]
output-name = "web_app"
# bin
bin-target = "web_ssr"
bin-features = ["ssr"]
bin-default-features = false
lib-target = "web_app"
lib-features = ["hydrate"]
lib-default-features = false
# style
style-file = "style/main.scss"
.... As you probably imagine rebuilding things for spin with leptos building hydrate and ssr builds in rust takes not a little while 🙃. At least on my laptop... My ...
[component.web]
source = "./target/wasm32-wasip1/release/web_app.wasm"
allowed_outbound_hosts = []
key_value_stores = ["default"]
[component.web.build]
command = "export LEPTOS_OUTPUT_NAME=web_app && cargo leptos build --release && cargo build -p web_ssr --target wasm32-wasip1 --release --no-default-features --features ssr"
watch = [
"./web/src/**/*.rs",
"./web/Cargo.toml",
...
]
... Sadly I fail like this:
It appears these file names are set here github.com/leptos-rs/cargo-leptos/.../project.rs#L397C2-L404C11 and then here Would it make sense to change |
It appears as though the lib name is just the name of the package.
This has the unfortunate side effect that a custom lib name does not get properly picked up when using
serve
orbuild
, resulting an error when thefront
compilation tries to find{package_name}.wasm
instead of{lib_name}.wasm
.Example
Meanwhile, the
Cargo.toml
has:The text was updated successfully, but these errors were encountered: