Skip to content
This repository has been archived by the owner on Aug 10, 2022. It is now read-only.

JS snippets #26

Open
cecton opened this issue Dec 23, 2020 · 1 comment
Open

JS snippets #26

cecton opened this issue Dec 23, 2020 · 1 comment

Comments

@cecton
Copy link
Member

cecton commented Dec 23, 2020

I think JS can be imported and used from rust using this snippets thingies in wasm-bindgen: https://github.com/rustwasm/wasm-bindgen/blob/master/crates/cli-support/src/lib.rs#L634

This is missing in wasm-run and there is no public method in cli-support to generate them explicitly without generating a whole of different things.

@cecton
Copy link
Member Author

cecton commented Mar 13, 2021

Apparently there is an issue with wasm-bindgen snippets that remove the unused snippets of the final build. This is probably something we can address while doing this issue.

wasm-bindgen does this weird thing that when if the imported JS isn't used, it doesn't include in the binary. This becomes in a problem when all the JS needs to do is be imported to perform its function i.e. load the web component. This hack is required to have components to load (ranile/material-yew#1). This is non-optimal but there is nothing Yew can do about it.

yewstack/yew#1666

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

No branches or pull requests

1 participant