Neon fails when having a main.rs file
paviro opened this issue · comments
Hi,
My project also builds a CLI tool from main.rs it seems like as soon as a main.rs is present neon fails with
> neon dist < cargo.log
error: No artifacts were generated for crate
Moving it to main_.rs and then back to main.rs when building with neon works.
Best,
Paul
I believe when a crate is both a lib and a bin cargo
defaults to building the bin. Can you try adding adding --lib
to the build command?
cargo build --lib
Sadly this does not help. But also without it cargo does build both the bin and the lib.
My workaround right now is:
cd src && mv main.rs main_.rs && cd ..
npm run build
cd src && mv main_.rs main.rs && cd ..
Looks ridiculous but works for my case. Thank you for the additional hints though!
I'm glad you have a workaround! If you have a second to test cargo-cp-artifact
to see if it works, that will help narrow down if the issue was introduced in the new CLI. Thanks!
I am quite new to rust and neon so I am not sure what exactly to test. Could you give me a hint?
I can reproduce too! I'll get this fixed asap.
Found the culprit. I'll publish a fix soon!
@paviro What version of @neon-rs/cli do you have in your package.json? I've published a new version that fixes the issue, and it should work to just update to 0.1.69. But let me know if you have trouble upgrading and I'll be happy to help.
(Reopening for now just to make sure it actually works for @paviro.)
It works, thank you for the quick fix! And for being so lovely to reopen the issue until I confirmed, made me smile!
thanks. update the newest version help me fix the problem.