avacore1337 / OneLife

My Vue/WASM/Rust idle game
https://avacore1337.github.io/OneLife/
MIT License
1 stars 2 forks source link

fix "debug_assertions" in Cargo.toml #13

Closed dimitrilw closed 1 year ago

dimitrilw commented 1 year ago

This issue is a carry-over from Issue #9 . Pasting relevant information below:

Cargo.toml file contains a debug_assertions section, which results in warnings: image

The URL ref'd in the warning is: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies

That page explains how making a cfg(debug_assertions) doesn't work as anticipated.

In addition, this issue in the rust-webpack-template repo explains that this needs to be removed from the walk-through because it is misleading. And it was removed. The current walk-through contains this updated guidance: https://rustwasm.github.io/wasm-pack/book/tutorials/npm-browser-packages/template-deep-dive/cargo-toml.html#3-features-and-wee_alloc-console_error_panic_hook-dependencies

However, I am not 100% confident about implementing the solution. When I followed the new guidance, it did appear to work, but I lack the familiarity with the build-n-deploy chain, so my confidence is lacking. Therefore, I submitted PR #12 to close out Issue #9 and added this issue to track the remaining task. I intend to loop back to this issue after gaining more confidence with this repo, Rust, and the build process.

dimitrilw commented 1 year ago

@avacore1337 , are you able to describe to me in a "explain it like I'm 5" manner what the debug_assertions bit in Cargo.toml does? In other words, if I break this while trying to implement the new guidance, how would I know I broke it?

lines ref'd

I ask because I did implement it locally, but I have no idea what changed. 😊

avacore1337 commented 1 year ago

If you build the game for release, the debug menu disappears. It also actually removes the function so you can use them for cheating.

dimitrilw commented 1 year ago

Thank you. I'll try doing dev & release build with how it is right now, then compare with the version following new guidance. I will try to ensure both dev & release demonstrate same handling of debug menu. Thank you for the dumbed-down version -- just what I needed.

dimitrilw commented 1 year ago

Finally carving out some time to tinker on this.

Right now, I understand how to get both the dev (with debug) and prod (no debug) versions up and running with original code. I am about to confirm that when I put the changes back in place, the code still builds & operates as expected.

dimitrilw commented 1 year ago

PR #19 closes this issue.