-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use basic-http-server from crates.io. #1339
Conversation
Any particular reason to use |
Nope, I simply did not know of the https crate. One reason I stopped looking for other minimal http servers on crates.io once I found basic-http-server was that alexcrichton is one of the owners of basic-http-server. |
Oh dear I didn't even know that I was on that crate! I've personally been happily using |
My reason for replacing python3 is that I didn't have it installed by default on the machine I happened to be trying out wasm-bindgen on, macOS. That was a speed bump I wanted to smooth out for future users trying out the same wasm-bindgen examples.
That link refers to wasm-pack, the examples I was trying out was https://github.com/rustwasm/wasm-bindgen/tree/master/examples/without-a-bundler-no-modules and https://github.com/rustwasm/wasm-bindgen/tree/master/examples/without-a-bundler, I could have added that in the original post. I regularly have to work with a couple of projects using node and npm due to, reasons, and have had some very bad experiences with those projects and would very much like to avoid any tooling and frameworks that depends on, or in any way interact with nodejs for new projects. Please keep npm and nodejs decoupled from wasm-bindgen, please? :) |
@anderejd I wonder if in the meantime this could switch to For rustwasm/rfcs#10, it's intended to be used for those two example, and |
On macOS sure, but Windows doesn't have python by default. I guess my preference is to promote Rust based tools over Python and that preference could be the main driving factor for me posting this PR in the first place. If python is not considered an issue on any platform this PR can obviously be closed.
Thank you for the clarification, that sounds great! I got the impression that wasm-pack was primarily an npm integration tool from reading the current readme on crates.io. |
Ah that's true yeah, but the shell scripts really aren't that appropriate for Windows anyway. In general the idea was that the shell scripts are just examples and aren't really meant to be copied/executed literally. Ideally we will have no shell scripts at all (which rustwasm/rfcs#10 empowers), but it'll take us a bit to get there. Other than that we're just left with the question of what to do in the meantime. Perhaps there could simply be a comment there saying "the files in this directory can now be served up" and point to some docs explaining some various ways how to do that? |
@anderejd wasm-pack is intended for all workflows, including without npm. However, you are right that the docs are misleading, and there is work being done to improve that: rustwasm/book#150 |
I feel like I'm wasting your time here now :) The PR was intended to smooth over a minor speed bump in one or two of the examples, nothing more. If a proper fix is coming in wasm-pack, that does not depend on npm, that sounds great to me! EDIT: https://rustwasm.github.io/docs/wasm-pack/#prerequisites says NPM is a prerequisite, I'm confused again. Is wasm-pack usable without NPM? Sorry for going off-topic. EDIT 2: Related to documentation regarding NPM and wasm-pack: rustwasm/wasm-pack#466 I would like the documentation to say something about what EDIT 3: Here's a link to my initial attempts at using wasm-bindgen with the no-bundler example: https://github.com/anderejd/wasm-bindgen-minimal-example Again, feel free to close this now since I have gone way off topic. I hardly know any of the wasm-bindgen tools yet, I'm just starting to scratch the surface here so my expectations and assumptions about how the tools interact and are supposed to work could be completely wrong. |
@anderejd oh no worries! I personally feel that is a somewhat difficult situation in that there's not really any great recommendation here. Using Python builtins are easy but not always availble. Using Rust crates means we have to pick one and users are highly likely to need to install something (which can take awhile). The best of all worlds is definitely
Good point! I've sent a PR to clarify these docs.
A good point! We'll hopefully have a chance to once-over wasm-pack docs soon, but rustwasm/book#150 is also likely going to help out with this. |
I'm gonna go ahead and close this while we wait for the RFC to settle, but thanks regardless for the PR @anderejd! |
Avoids
python3
as dependency in some examples by using basic-http-server.