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

not possible to run examples #1162

Closed
1 of 3 tasks
fbucek opened this issue Apr 28, 2020 · 4 comments · Fixed by #1165
Closed
1 of 3 tasks

not possible to run examples #1162

fbucek opened this issue Apr 28, 2020 · 4 comments · Fixed by #1165
Labels

Comments

@fbucek
Copy link
Contributor

fbucek commented Apr 28, 2020

Problem
Not possible to run examples .
Missing doc how to run them.

Examples looks they are prepared for both wasm-bindgen and wasm-pack but I think it cannot be mixed together.

wasm-pack needs this and must have main method defined within lib.rs

[lib]
crate-type = ["cdylib", "rlib"]

lib.rs

#[wasm_bindgen(start)]
pub fn run_app() {
    yew::start_app::<Model>();
}

wasm-bindgen needs main.rs and must not have crate-type = ["cdylib", "rlib"] in Cargo.toml

Environment:

  • Yew version [master]
  • Rust version [1.42.0]

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@fbucek fbucek added the bug label Apr 28, 2020
@jstarry
Copy link
Member

jstarry commented Apr 28, 2020

Cool, yeah I think someone recently went through and added

[lib]
crate-type = ["cdylib", "rlib"]

for wasm-pack support because wasm-pack runs crates as libs. Which honestly isn't my favorite approach. Patiently waiting for this to get fixed in rustwasm/wasm-pack#736 :)

I prefer using wasm-bindgen because it supports binary crates, @fbucek thoughts?

@fbucek
Copy link
Contributor Author

fbucek commented Apr 28, 2020

@jstarry I have learning repo where I have silly sort

implementation. There are two examples. One prepared for wasm-bindgen and second for wasm-pack, both using same index.html in static folder.

Both examples produces "same" results.

https://github.com/fbucek/yewbulma/tree/feat/table/examples

@hgzimmerman
Copy link
Member

Whoops, I assume that's my bad. I've recently ported tests from using std_web/``cargo-web to use wasm-pack for the router's test suite and didn't know about a conflict with wasm-bindgen. I'm inclined to defer to using wasm-bindgen instead if everything else is set up to use that.

@jstarry
Copy link
Member

jstarry commented Apr 28, 2020

No, not your bad @hgzimmerman. web-sys examples have been busted since we added support ofr it (just more noticeable that it's just web-sys examples now in the root examples dir)

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

Successfully merging a pull request may close this issue.

3 participants