Roquentin
Roquentin

Reputation: 207

How can I convert an existing cargo binary to a library

I have an existing cargo project which I would like to work with web-asm. However, wasm-pack build fails because my project is a binary rather than a library. How can I circumvent this problem while still keeping my version control history?

Upvotes: 2

Views: 5976

Answers (1)

Lyokolux
Lyokolux

Reputation: 1417

These answers may help you : https://stackoverflow.com/a/26946705/11732874

It works for a default bin package on edition 2018. You can put this in your cargo.toml

[lib]
name = "YourPackageName"
path = "src/PathToMain.rs"

How can I circumvent this problem while still keeping my version control history?

What do you mean ?

Upvotes: 3

Related Questions