Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
The instructions at “Getting Started/Project Setup/Using wasm-pack” are extremely unclear #60
Comments
|
Totally agree that the docs need to be much clearer. I think this might be more of an examples issue than a docs issue Edited to remove incorrect statement about tooling |
|
No it's definitely a docs issue, it doesn't say where the See here: https://github.com/yewstack/yew-wasm-pack-minimal/blob/master/main.js |
|
Thank you, with that file, I eventually got it working.
to
Is this how the examples are intended to be built and run? In that case, I can try fixing them up and expanding the documentation. |
|
Honestly, it's hard to answer that. I'm not a big fan of the I think for the examples we can get by with a script that calls For the docs, we should add your steps that you've laid out since the "Using wasm-pack" section is totally broken. Do you mind fixing that? |
|
No, I can do that. Should I refer to the Also, what would you say is the best way to actually produce a frontend app? The |
|
Best is too subjective IMO. My personal app uses I don't think Yew needs to give a strong recommendation at this point. I think the ideal solution is basically laid out here: yewstack/yew#1086 |
|
I finally got around to trying one of the examples (the |
|
I remember an issue I had getting started with wasm-pack/rollup where the problem turned out to be the Node version I was using. I had to tell NVM to use a much more recent version than the system version, but this was not at all clear from the error message I got. Maybe specifying a minimum Node version in the Getting Started section would be nice. |
I’ve been trying and failing for a while to apply the instructions to the
web-sysexamples in theyewrepository. I’ll taketodomvcas an example. Everything up to and includingwasm-pack buildis fine. The problems start at the next line:Ok, there is no
main.js, so maybe I should putpkg/todomvc.js? Well,Ok, so I need to install a
wasmplugin forrollupwithnpm install @rollup/plugin-wasm --save-devand add a filerollup.config.jscontainingNow I can run
rollup -c rollup.config.js pkg/todomvc.js --file pkg/bundle.js. Cool. The next step is(or any other server, as the tutorial notes). Running this and visiting
localhost:8000in my browser shows me the contents of thetodomvcdirectory. Ok, not exactly what I wanted, so I runbecause
index.htmlis in thestaticdirectory. This time I get a page with the titleYew • TodoMVC, which is good, but the page is entirely blank. The console shows the error messageLoading failed for the <script> with source “http://localhost:8000/todomvc.js”., which makes sense to me becausetodomvc.jsresides inpkg. Also, I am now unsure whether usingrollupeven accomplished anything because I haven’t interacted withbundle.jsin any way.Maybe I’m going about this very stupidly. After all, I am a complete beginner when it comes to any sort of web development.