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

How to rebuild upon changes to rust source? #185

Closed
mtharrison opened this issue Jun 15, 2018 · 8 comments
Closed

How to rebuild upon changes to rust source? #185

mtharrison opened this issue Jun 15, 2018 · 8 comments
Labels
PR attached there's a PR open for this issue question Further information is requested

Comments

@mtharrison
Copy link
Contributor

The docs mention wasm-pack init to initialize a project with wasm-pack. This creates the package files in pkg by performing quite a few steps and takes a while (2 mins on a smallish project for me).

My question is when I make changes to the Rust source how do I then just rebuild what is in pkg? Do I invoke Rust compiler and wasm-bindgen manually, or does wasm-pack provide something like a build command that only does this?

Also do you think it's useful to mention this in docs? If so, I'm happy to make a PR for that.

@mtharrison mtharrison changed the title How to rebuild upon changes to rust? How to rebuild upon changes to rust source? Jun 15, 2018
@mgattozzi
Copy link
Contributor

Hmmm this is unclear I guess, but you use init as the command to build it as well! cc/ @ashleygwilliams maybe we need to consider different commands or verbiage? Or just better docs.

@mgattozzi mgattozzi added the question Further information is requested label Jun 15, 2018
@mtharrison
Copy link
Contributor Author

mtharrison commented Jun 15, 2018

Sure you could use init again but if I do that, init it takes around 2 mins whereas if I just run the following it's almost immediately completes and does what I need:

cargo +nightly build --target wasm32-unknown-unknown
wasm-bindgen target/wasm32-unknown-unknown/debug/my_wasm.wasm \
--out-dir pkg

For now I've put that in a script and invoke it using a Makefile but I'm curious how other's workflow looks. Maybe this is outside the scope of wasm-pack?

@mgattozzi
Copy link
Contributor

So there's a problem outlined in #115 that we kept running into. There's a flag added in https://github.com/ashleygwilliams/wasm-pack/issues/144 that will make it easy to just skip that stuff that makes the build take forever that's being released (hopefully) today. We are trying to make the tool handle, if I need to upgrade bindgen how and how is it tied to this version for the program. It's just something we haven't necessarily gotten around too/found the best solution to yet. It's not outside the scope of wasm-pack! We're just trying to figure out some things and wasm-bindgen is kind of the main driver of those since it's development is in flux.

@ashleygwilliams
Copy link
Member

yeah i was actually gonna make a --no-install flag today that runs exactly what you shared @mtharrison - i sorta like wasm-pack build more but dont wanna make that call without discussion! would love to hear more about the set of commands you'd expect and what they should be named! we've been growing kinda fast and have def outgrown our original definitions-

@mtharrison
Copy link
Contributor Author

Cool, that will do the job I think. In terms of expectation, I would probably expect either wasm-pack build or maybe just wasm-pack ..

@ashleygwilliams
Copy link
Member

@mtharrison a first pass at fixing this is landing in today's 0.4.0 release, you can invoke it as wasm-pack init <optional path> --mode no-install, but for the next release i think we'll figure out how to separate init into build and init

@ashleygwilliams ashleygwilliams added the PR attached there's a PR open for this issue label Jun 18, 2018
@ashleygwilliams
Copy link
Member

ashleygwilliams commented Jun 18, 2018

closed by #186 and convo for splitting the commands is now in #188

@mtharrison
Copy link
Contributor Author

That's great news, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR attached there's a PR open for this issue question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants