Skip to content

Building with build.rs #3494

Closed Answered by daxpedda
max-sixty asked this question in Q&A
Jun 20, 2023 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

I'm surprised I'm the first person to think that cargo build should build the full project, including the JS shims — am I missing something?

That is the desired goal ofc, unfortunately this requires a dedicated target in Rust, which doesn't currently exist. Something like wasm32-web. I'm not entirely sure what you intend to do btw, but you can't build the JS shim from build.rs for that same project.

The current flow looks like this:
Rust runs your build.rs -> then it compiles your crate -> produces a .wasm file -> you run it through wasm-bindgen-cli.

You can't let your build.rs generate the JS shim and fix you .wasm file because it runs before compiling the crate in the first place.
Wha…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@max-sixty
Comment options

@daxpedda
Comment options

Answer selected by max-sixty
@max-sixty
Comment options

@max-sixty
Comment options

@daxpedda
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #3490 on June 21, 2023 15:12.