In this section I outline my personal motivation for starting this project.
I've used webpack and webpacker extensively in the past few years. Both are good libraries, with their merits and caveats.
Webpack is powerful, but it can be daunting to configure and it takes time to understand it well. Raise your hand if you have seen a webpack config that made you cringe.
Webpacker provides integration with Rails, but adds several hard dependencies which can make upgrades a painful experience.
Additionally, since it does not use webpack-chain, opting out of the default loaders is difficult, and integration with tools like vue-cli requires full understanding of the underlying implementation.
My original goal was to release a webpacker and vue-cli integration so that everyone could benefit, but that was soon going to change.
Webpack—increasing load times
If you have worked on a large frontend application, you have probably experienced increasingly long startup times for webpack as the amount of code and dependencies grew.
It gets worse when HMR or incremental compilation starts to slide from under one second, to one, two, three seconds, or more! Should I refresh the page?
Creators need an immediate connection to what they're creating.
Vite—no bundling in development
When I first heard about Vite.js I became excited about its architecture, which leverages native ESM in modern browsers to process files on demand.
This design decision has major implications: as your application grows, startup time does not keep crawling up. Incremental builds are extremely fast, since processing happens on demand.
A friend said that it changes the game, and I couldn't agree more.
Vite.js brought me closer to having an immediate connection with my creations.
Less dependencies, friendly for beginners, easy to hack
Vite's documentation is excellent, and its internals are easy to navigate since the codebase is written in TypeScript, which is really convenient when writing a plugin.
I decided to write a prototype in Rails that had a similar level of integration as webpacker provided for webpack. It worked!
Then, I chose to refine it, document it, and release it. The end result is Vite Ruby.
The design of Vite Ruby shares a common thread with the design of Vite.js.
I wanted to achieve a nice experience out of the box by providing strong conventions, while at the same time allowing the user to opt-out or tweak as needed.
In short, I'm striving to achieve a good balance.
I hope that you find this project as useful as it has been for me.
This project wouldn't exist without Vite.js.
Webpacker broke ground in the Rails community by enabling everyone to use webpack and any modern framework, without struggling with the assets pipeline. It has been a major inspiration for this project.
Thanks to Nick Cherry for sharing this fantastic speech many years ago.
Please visit GitHub Issues to report bugs you find, and GitHub Discussions to make feature requests, or to get help.
Don't hesitate to ⭐️ star the project if you find it useful!
Using it in production? Always love to hear about it! 😃