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

Make how to write dependencies acurate #1577

Closed
wants to merge 1 commit into from

Conversation

wataash
Copy link

@wataash wataash commented Sep 21, 2020

Description

Prevent beginners from seeing build errors::

error[E0433]: failed to resolve: use of undeclared type or module `web_sys`
  --> src/lib.rs:24:21
   |
24 |         let window: web_sys::Window = web_sys::window().expect("window not available");
   |                     ^^^^^^^ use of undeclared type or module `web_sys`

or

error[E0433]: failed to resolve: use of undeclared type or module `stdweb`
  --> src/lib.rs:27:21
   |
27 |         let window: stdweb::web::Window = stdweb::web::window();
   |                     ^^^^^^ use of undeclared type or module `stdweb`

Checklist

  • I have run cargo make pr-flow
  • I have reviewed my own code
  • I have added tests

@siku2
Copy link
Member

siku2 commented Sep 21, 2020

These libraries aren't strictly required to use Yew so I'm not sure if we should really list them there.
New users might end up confused by this, as they're never using web-sys directly.
Maybe there's a better place to inform the user of these dependencies?

@wataash
Copy link
Author

wataash commented Sep 21, 2020

I see, but then should we remove or move ## Example Usage section?
Newbies would copy-paste these code without adding web-sys, and see the errors (at least I did).

@siku2
Copy link
Member

siku2 commented Sep 21, 2020

stdweb will be gone soon anyway (#1569) so this entire section will hopefully be rewritten.
Not sure if it makes sense to take action because of that, but I'm fine with removing the example usage section. It doesn't even remotely paint the full picture.

@jstarry
Copy link
Member

jstarry commented Sep 21, 2020

First, I think this whole section will go away when we phase out support for stdweb.

I personally think it's fine to have explicit dependencies on these libraries. Most apps will probably need to do so. Note that web-sys is re-exported by Yew though and can be accessed by yew::web_sys

@wataash
Copy link
Author

wataash commented Sep 21, 2020

Whoa, okay, so I close this PR and wait for the rewriting.

Thank you.

Note that web-sys is re-exported by Yew though and can be accessed by yew::web_sys

Good to hear that!

@wataash wataash closed this Sep 21, 2020
@wataash wataash deleted the clearify-dep branch September 21, 2020 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants