Cargo wasm build using subcommand

#1

My project consists of two components. The directory tree looks like this:

.
├── Cargo.lock
├── Cargo.toml
├── client
│   ├── Cargo.toml
│   └── src
│       └── main.rs
└── server
    ├── Cargo.toml
    └── src
        └── main.rs

The top-level Cargo.toml is simply a workspace:

[workspace]
members = [ "server", "client" ]`

client is an stdweb project, which needs to be built using the Cargo subcommand cargo web build.

server is compiled as usual, using cargo build.

What is the best way to set this up? I want the whole workspace to build correctly when I simply issue a top-level cargo build command.

Do I need to write a build.rs script for the client, or is there an easier way to accomplish this, since I’m still compiling Rust code?

0 Likes

#2

Seems to be a fundamental limitation of the tool. More discussion here: https://github.com/koute/cargo-web/issues/173

0 Likes