TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

2 点作者 lionside5 个月前
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 个月前
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> ```