Skip to content
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

LeptosOptions output_name is always leptos_config #3268

Open
gauravjuvekar opened this issue Nov 20, 2024 · 1 comment
Open

LeptosOptions output_name is always leptos_config #3268

gauravjuvekar opened this issue Nov 20, 2024 · 1 comment

Comments

@gauravjuvekar
Copy link

/// The name of the WASM and JS files generated by wasm-bindgen. Defaults to the crate name with underscores instead of dashes

The docs claim this refers to the crate name, but because crates are compiled independently, this name is always "leptos_config".
Should it be changed to CARGO_PKG_NAME instead?

MRE

#Cargo.toml

[package]
name = "repro"
version = "0.1.0"
edition = "2021"

[dependencies]
leptos = { version = "0.6.15" }
// src/main.rs

fn main() {
    use leptos::*;

    println!("Crate name is {}", env!("CARGO_CRATE_NAME"));

    let options = LeptosOptions::builder().build();
    let default_options = LeptosOptions::default();

    println!("Options output name is {}", options.output_name);
    println!("Default options output name is {}", default_options.output_name);
}
$ cargo run -q
Crate name is repro
Options output name is leptos_config
Default options output name is leptos_config
@chrisp60
Copy link
Contributor

I believe if you ran a blame on this it was actually me that introduced this bug. Not that it really matters.

From my understanding of the docs here, the options to solve this problem aren't great unless you want to use a macro_rules! or build script.

Probably CARGO_PRIMARY_PACKAGE would be the next thing to try.

I could be wrong but the difference between between CARGO_PKG_NAME and CARGO_CRATE_NAME is that one exchanges - for _.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants