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

should we *continue* to enforce cargo build --lib #326

Closed
ashleygwilliams opened this issue Sep 21, 2018 · 2 comments
Closed

should we *continue* to enforce cargo build --lib #326

ashleygwilliams opened this issue Sep 21, 2018 · 2 comments
Labels
question Further information is requested

Comments

@ashleygwilliams
Copy link
Member

ashleygwilliams commented Sep 21, 2018

digging into the bug from #303 has made me consider if we should enforce that cargo build build only the lib, by passing --lib. this leads to a few questions:

  • are the legitmate reasons to write an binary application that is compiled by wasm-pack and published to npm? i'm thinking that potentially devtools e.g. a CLI application may actually be a use case we want?
  • this begs the question... does wasm-pack even work at all right now for that scenario, what would the requirements be? i'm pretty sure that the package.json keys we are using and that we don't put anything in a bin directory would suggest it wouldn't.
  • begging the final question: is this something we want to support? if so, what would an interface for this look like?

EDIT: i want us to enforce lib only until we can reasonable answer the rest of these questions, hence #329

@ashleygwilliams ashleygwilliams added the question Further information is requested label Sep 21, 2018
@ashleygwilliams ashleygwilliams changed the title should we enforce cargo build --lib should we *continue* to enforce cargo build --lib Sep 21, 2018
@konstin
Copy link
Contributor

konstin commented Sep 23, 2018

I had a similar situation in pyo3-pack: I started out with only supporting lib and then added bin support later. I ended up always setting --lib for lib targets and --bin for binaries. (Actually --bins, but that's because I haven't done multi-bin projects yet). For python packages the structure is different for binaries and for libraries, so you need to know the target before building anyway and it's a non-effort to set the right flags. I think the same is true for npm packages.

are the legitmate reasons to write an binary application that is compiled by wasm-pack and published to npm? i'm thinking that potentially devtools e.g. a CLI application may actually be a use case we want?

There are actually two different cases to consider: Taking native binaries and distributing them through node and having pure wasm applications. The first case is definitely desirable. e.g. if someone wanted to do py-spy or rbspy for node. For the latter there's afaik no project above toy status that makes standalone wasm files runable, but I expect that to become important in the future. (wasm files run through a js shim are irrelevant here because we can still use --lib for those).

@ashleygwilliams
Copy link
Member Author

closing as this hasn't really gotten attention, when/if it becomes a pressing issue, i'm sure it will come back up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants