-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from Webpacker to Vite Rails #1
Conversation
@ElMassimo this is really nice – thanks for sharing on Vite Land Discord! :) I don't know a lot about Inertia, but I see they have support for Vue 3 too. Do you intend to make it work with Vue 3 too or are you open for PRs – maybe I can take a look into it. |
Thanks! Creating a Vue 3 version would be great! I want to keep this Vue 2 example because it's less common with Vite, so we could create a I would happily accept a pull request, using Vue 3 and sticking to the options API, or using Vue 3 and |
I am currently using Rails6.1.4/Webpacker 6. I added the gem |
@ndrean Hi Neven! You can follow the guide or this blog post to get started. Try running Cheers! |
Thanks Maximo. The dev server responds indeed after |
Description 📖
This pull request is an example on how to migrate from webpacker to Vite Rails.
Steps 👟
vite_rails
gem, and runbin/rake vite:install
..vue
extension to any imports, since Vite requires it.javascript_packs_with_chunks_tag
withvite_javascript_tag
.asset_pack_path
withvite_assets_path
.import.meta.glob
.More information available in the migration guide.
Development 🚀
Now, run
bin/vite
instead ofbin/webpack-dev-server
, and code as usual, but with faster feedback ⚡Comparison 🎥
Webpacker
Took 31 seconds to start, and then 1-2 second lag for every simple change:
webpacker.mp4
Vite
Took 15 seconds to start, and then super quick feedback on every change:
vite_rails.mp4