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

STDWEB_PRIVATE will be null if use stdweb only from other crate (0.4.0) #135

Closed
edwin0cheng opened this issue Feb 24, 2018 · 5 comments
Closed

Comments

@edwin0cheng
Copy link

I just updated my project to use 0.4.0 and found that if my main crate only use stdweb from other crate, (i.e the main crate itself do not depend on stdweb, but it depend on a crate which is depends on stdweb)

when run it in browser, it will fail :

Error loading Rust wasm module 'unigame': TypeError: Cannot read property 'from_js' of undefined

but It works in 0.3.

@koute
Copy link
Owner

koute commented Feb 24, 2018

Hm, it works for me.

  1. How are you compiling your project? Are you using cargo-web?
  2. Can you post a minimal reproduction?

@edwin0cheng
Copy link
Author

@edwin0cheng
Copy link
Author

It seem like to because this line in other-lib cargo.toml :
[target.'cfg(target_arch = "wasm32")'.dependencies]

@koute
Copy link
Owner

koute commented Feb 24, 2018

Hmm... ah, yes, I know what is the problem.

For now you can replace your

[target.'cfg(target_arch = "wasm32")'.dependencies]

with

[target.wasm32-unknown-unknown.dependencies]

and it will work.

Thanks for the report!

@koute
Copy link
Owner

koute commented Feb 24, 2018

Since this is a cargo-web issue I'm going to close this; however I opened up a new issue in cargo-web repository.

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