-
Notifications
You must be signed in to change notification settings - Fork 409
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
The cdylib's name can be overriden by lib.name #339
Labels
Milestone
Comments
3 tasks
ashleygwilliams
added
bug
Something isn't working
to-do
stuff that needs to happen, so plz do it k thx
labels
Sep 23, 2018
alexcrichton
added a commit
to alexcrichton/wasm-pack
that referenced
this issue
Nov 6, 2018
This commit fixes an issue where if a library is renamed via the `name` key in the `[lib]` section of the manifest then `wasm-pack` would try to generate bindings for an noexistent wasm-file, generating an error. The fix was to internally use `cargo_metadata` more aggressively and move around where this data is generated. This ended up refactoring a few locations, but this should also bring improved error messages for `cargo metadata` as well as caching the resulting data more aggressively to avoid recalculating it too much. Closes rustwasm#339
alexcrichton
added a commit
to alexcrichton/wasm-pack
that referenced
this issue
Nov 6, 2018
This commit fixes an issue where if a library is renamed via the `name` key in the `[lib]` section of the manifest then `wasm-pack` would try to generate bindings for an noexistent wasm-file, generating an error. The fix was to internally use `cargo_metadata` more aggressively and move around where this data is generated. This ended up refactoring a few locations, but this should also bring improved error messages for `cargo metadata` as well as caching the resulting data more aggressively to avoid recalculating it too much. Closes rustwasm#339
alexcrichton
added a commit
to alexcrichton/wasm-pack
that referenced
this issue
Nov 6, 2018
This commit fixes an issue where if a library is renamed via the `name` key in the `[lib]` section of the manifest then `wasm-pack` would try to generate bindings for an noexistent wasm-file, generating an error. The fix was to internally use `cargo_metadata` more aggressively and move around where this data is generated. This ended up refactoring a few locations, but this should also bring improved error messages for `cargo metadata` as well as caching the resulting data more aggressively to avoid recalculating it too much. Closes rustwasm#339
ashleygwilliams
added
changelog - fix
and removed
bug
Something isn't working
question
Further information is requested
to-do
stuff that needs to happen, so plz do it k thx
labels
Jan 11, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug description
Currently, wasm-pack assumes the cdylib's name is the crate name with underscores and
.wasm
as extension, while this value can be overwritten bylib.name
in Cargo.toml.👟 Steps to reproduce
Cargo.toml
src/lib.rs
Output of
wasm-pack build --mode no-install --debug
🖥️ Relevant code
wasm-pack/src/manifest/mod.rs
Lines 264 to 267 in 120236f
And wasm_bindgen_build
🤔 Expected Behavior
While checking for
lib.name
would fix this particular issue, it's definitely not future proof and I assume there are already cases today where this still wouldn't work.One solution would be asking cargo through
cargo metadata
. Relevant excerpt:The other option would be to use the info from
--message-format=json
in #333 to get the target name. This is e.g. the prettified last line fromcargo build -q --message-format json --target wasm32-unknown-unknown
:Both solutions would supersede #25.
❔ Unresolved question
Should the lib name influence how the exports are named? Like we could use
const js = import("@MYSCOPE/c/d.js");
in the example.The text was updated successfully, but these errors were encountered: