2

Using [[bin]] in Cargo.toml allows me to compile multiple binaries from the same source of a Rust project.

But I want to deploy multiple web-components from the same source, and web-components are compiled as libraries. There is, however, no [[lib]], only [lib] which allows only a single compile target.

I am new to Rust and Cargo so I don't yet fully understand every part of the ecosystem entirely, but I wonder how to go about building my multiple web-components without having a dozen small repositories?


If it matters, I plan to use the webcomponent system of web-dom for this project, while I've used wasm-bindgen for another one with a similar setup (but only 2 components, so it wasn't much of an issue).

Tom
  • 2,688
  • 3
  • 29
  • 53
  • 1
    You don't have to have separate *repositories*, but you do have to have multiple Cargo projects. – Shepmaster Apr 03 '19 at 23:49
  • 4
    you can have multi workspace, I think that should work in your case if I correctly understand what you want – Stargateur Apr 03 '19 at 23:50
  • @Shepmaster - it's not a duplicate. That question asks why there's only one [lib]. I don't particularily care about the why. I want to know how to set up my project with multiple web-components without having to duplicate everything inside. – Tom Apr 04 '19 at 00:32
  • @Stargateur can you elaborate on that? It might be exactly what I'm looking for. – Tom Apr 04 '19 at 00:33
  • 1
    @Tom just google it... https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html https://doc.rust-lang.org/cargo/reference/manifest.html#the-workspace-section – Stargateur Apr 04 '19 at 00:48

0 Answers0