TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Embed ViteJS-compiled assets in your Rust binary

2 pointsby lionside5 months ago
Dear HN community --<p>Merry Christmas, Happy Hannukah, and all the best in the upcoming new year :)<p>Just wanted to share a crate I&#x27;ve been working on that I finally felt was ready to publish. It&#x27;s primary purpose is to make it easy to integrate ViteJS with your Rust project. It tries to be a low-touch integration so you can continue using ViteJS as you normally would.<p>The next step for this is to show the community how you could integrate this into templating engines and web frameworks like `actix-web`&#x2F;`axum`&#x2F;`poem`&#x2F;etc. I&#x27;ve previously drafted a ViteJS integration for Rust backends[1] in `create-react-app` and I hope to adapt that to use `vite-rs` soon.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;Wulf&#x2F;create-rust-app&#x2F;blob&#x2F;main&#x2F;create-rust-app&#x2F;src&#x2F;util&#x2F;template_utils.rs#L44">https:&#x2F;&#x2F;github.com&#x2F;Wulf&#x2F;create-rust-app&#x2F;blob&#x2F;main&#x2F;create-rus...</a>

1 comment

lionside5 months ago
Oh, one more thing! I&#x27;d like to share an excerpt from the README to make sure folks considering this approach understand all the cons that I could think of:<p>```<p>As with all things in life, there are considerations to take into account before using vite-rs:<p><pre><code> It&#x27;s one more thing to debug when things go wrong. It&#x27;ll increase compile time. See the note on compile times for large assets. For those deploying to embedded devices: it&#x27;ll increase your binary size. Shipping frontend with your backend can slow you down as you&#x27;ll have to wait for your Rust backend to compile everytime you want to release a new build. Similarly, failing CI&#x2F;CD pipelines pertaining to the backend will also stop your frontend frontend from deploying. It may be faster or cheaper to deploy your frontend on CDNs instead of serving it.</code></pre> ```