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

Support building debug versions of packages. #126

Closed
itsybitesyspider opened this issue May 25, 2018 · 3 comments
Closed

Support building debug versions of packages. #126

itsybitesyspider opened this issue May 25, 2018 · 3 comments
Labels
PR attached there's a PR open for this issue to-do stuff that needs to happen, so plz do it k thx
Milestone

Comments

@itsybitesyspider
Copy link
Contributor

I had a personal need to generate a debug version of a package in my project and quickly implemented a --debug flag. It may require some bikesheddish discussion:

(1) --debug is the opposite of the flag used by cargo (--release). Usage is more obvious if the wasm-pack flag is identical to the already-familiary cargo flag, however switching to --release also changes the default behavior of wasm-pack.

(2) There's a --debug flag in wasm-bindgen that we might also hook into.

(3) Not sure if this is within the scope of wasm-pack.

@ashleygwilliams
Copy link
Member

hi @clanehin - thanks for filing this! i'm not opposed to a feature like this- though i am curious to learn more about the use case you had to generate a debug version of a package- would you mind sharing?

@ashleygwilliams ashleygwilliams added PR attached there's a PR open for this issue feature request labels May 29, 2018
@itsybitesyspider
Copy link
Contributor Author

Sure. Easiest just to tell the story. I was working on an electron app structured as a lerna monorepo. I decided that some of the modules were good candidates to experimentally port to rust, which I did, partly because wasm-pack was so easy to use.

Inevitably, one of the components had a bug, and I wrote some assertions to catch the problem early. The assertions are useful and I want to keep them in the program, but they change the big-O runtime of the program rather dramatically, so it seemed to make sense to put them behind cfg(debug_assertions).

Of course, those assertions only fire in --debug. At that point, adding the debug flag to wasm-pack was easy, and I've been wanting to contribute more anyway, so I did, and here we are. :)

I can budget some time to follow up with additional changes, if you think the project will benefit from them. Not sure what direction you want go, though.

@ashleygwilliams
Copy link
Member

@clanehin thanks so much for sharing! i think i realy dig this and am gonna try to sneak it into today's release... :D

@ashleygwilliams ashleygwilliams added this to the 0.4.0 milestone Jun 5, 2018
@ashleygwilliams ashleygwilliams added to-do stuff that needs to happen, so plz do it k thx and removed feature request labels Jun 5, 2018
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 to-do stuff that needs to happen, so plz do it k thx
Projects
None yet
Development

No branches or pull requests

2 participants