Closed flosse closed 4 years ago
.. after running one cargo make watch
it's working.
Unable to repro on my end. This may be related to the hosting's config.
cargo make build
is missing in Steps to reproduce
. Server then returns 404 or index => MIME text/html
. You built / fixed it with watch
.
cargo make build
is missing inSteps to reproduce
. Server then returns 404 or index => MIMEtext/html
. You built / fixed it withwatch
.
Yes, I expected that cargo make serve
invokes a build
if it was not executed manually. Like usual Makefiles I don't need to build every single dependency but only call a make my-target
Still can't repro, on Linux/Win/Chrome/FF. Suspect it's a dev-server issue, but can't pin it.
@David-OConnor try to clone this repo into a new empty folder and then run cargo make serve
as the first and only command.
Or you can delete pkg
folder (with compiled wasm and js files) in your project which uses this quickstart and then run cargo make serve
.
(I can''t try if by myself now because I need to resolve some problems with my SSD..)
Nailed it! I apparently can't follow instructions. I'm not sure how to tackle the misleading error message; leaning towards having it auto-build if it can't find the pkg
folder, or perhaps the wasm
inside.
Edit: Not sure if there's an easy way to do this, given that makefiles
can't execute logic like checking if a folder exists. Having it always build before serve only costs ~1s for me, but dumps a lot in the console. May leave as-is. Thoughts on that?
Some ideas for tasks:
option
watch
rename to start
start_release
build
and serve
from READMEoption
watch_release
serve
to compile and crate wasmserve_release
etc.. There are more combinations.
Not sure if there's an easy way to do this, given that makefiles can't execute logic like checking if a folder exists.
Maybe it's possible to add checking task as a dependency to serve
task, but it seems a little bit over-engineered. I prefer deleting things / code or at least changing.
How about adding a start
task that runs build
, then serve
, and leaving existing build
, build_release
, and serve
unchanged ? Ideally we'd do watch
then serve
, but these two ongoing tasks appear to not be able to run simultaneously from the naive approach in Makefile.
Ideally we'd do watch then serve,
Yeah, I forgot that watch
doesn't start server. I was googling for a while but I don't know how to resolve it properly now, except writing some error-prone custom scripts or something like webpack;s dev-server in Rust...
One approach would be to make a rust Script that runs process::Command
for watch
and serve
, and get cargo-make
to run that. Would have to cleverly interlace the streaming outputs. For now, going to go with the start
addition to makefile
, and push it in the next release, along with the Init
change. (ie once the two open Seed PRs are merged). Can you think of a better approach using cargo make
alone?
Script that runs process::Command
Maybe you can reuse some code from https://github.com/David-OConnor/seed/blob/master/Makefile.toml#L258. I was fighting with console output in this script, so it maybe helps you a little with cleverly interlace the streaming outputs
.
Can you think of a better approach using cargo make alone?
Unfortunately no. If you encounter some problems while writing that script, we can create an issue in cargo-make
repo. I also tried to find something like https://www.npmjs.com/package/concurrently in Rust, but no luck (I'm using it for starting server + prerendering in seed-quickstart-webpack
).
Nailed it! I apparently can't follow instructions. I'm not sure how to tackle the misleading error message; leaning towards having it auto-build if it can't find the
pkg
folder, or perhaps thewasm
inside.Edit: Not sure if there's an easy way to do this, given that
makefiles
can't execute logic like checking if a folder exists. Having it always build before serve only costs ~1s for me, but dumps a lot in the console. May leave as-is. Thoughts on that?
I did exactly the same thing. I'm putting together a PR now that will hopefully make this mistake less likely to be made.
The whole quickstart and README rewritten. It should resolve this issue.
There are still two commands watch
and serve
for the sake of simplicity, however it should be clear from the README how to use them. Also watch
tries to compile the project AFTER the watch init, so it's more comfortable for developers to use.
Versions
Steps to reproduce
Errors
Firefox: Chromium: