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

fix "debug_assertions" in Cargo.toml #13

Closed
dimitrilw opened this issue Sep 7, 2023 · 5 comments
Closed

fix "debug_assertions" in Cargo.toml #13

dimitrilw opened this issue Sep 7, 2023 · 5 comments

Comments

@dimitrilw
Copy link
Contributor

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.

This was referenced Sep 7, 2023
@dimitrilw
Copy link
Contributor Author

dimitrilw commented Sep 10, 2023

@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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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 added a commit to dimitrilw/OneLife that referenced this issue Sep 17, 2023
Update Cargo.toml & src/lib.rs to reflect new guidance
on implementing console_error_panic_hook. Changes were
tested by:
  - npm run start
  - visual confirmation that dev site still has debug
  - npm run start:dist
  - visual confirmation that dist site does NOT have debug

Also:
- add scripts to package.json
  - start:dist ...& ref in readme
  - clean ...& use it in other npm scripts
- tidy build.rs & add comments
- edit readme: npm run-script -> npm run
- minor edit to test, to appease rust-analyzer
- fix clippy warning in info.rs
@dimitrilw
Copy link
Contributor Author

PR #19 closes this issue.

avacore1337 added a commit that referenced this issue Sep 17, 2023
issue #13, fix "debug_assertions" in Cargo.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants