Migrating from Webpacker to Vite - some recipes #227
Replies: 5 comments 12 replies
-
Thanks for sharing Stefan! 😃 I think it will be nice adding this article to a Related Articles footer in the Migration section of the docs. Let me know if you are ok with that, and I can add it (or a PR is also welcome). |
Beta Was this translation helpful? Give feedback.
-
One of the biggest confusion factors I faced was how Vite uses Turns out you can now use It worked well for me and I'd highly recommend it. I found that the One other little tip in my case is because I was adding
Hope that helps someone :) |
Beta Was this translation helpful? Give feedback.
-
If you use
I also had to add |
Beta Was this translation helpful? Give feedback.
-
Weirdly, the stuff you document around "@" did not seem to be necessary to me... With
Why is this working for me if it "shouldn't"? Have vite or vite-ruby changed since this was written? Or am I doing something "fragile" in any way? |
Beta Was this translation helpful? Give feedback.
-
That's pretty interesting. I've been using |
Beta Was this translation helpful? Give feedback.
-
We just successfully migrated a medium sized frontend app to Vite and removed a bunch of Webpack(er) dependencies.
I've written about all the errors that occurred and how we handled it., namely:
import FooComponent from "admin/dashboard/Component.vue"
instead of prefixing everything with@/
(by using alias)const foo = require("foo")
->import foo from "foo"
require.context
- just use @ElMassimo's helper repo 😛import Foo from "Foo"
->import Foo from "Foo.vue"
, the same is true for async imports:import("./components/Component.vue")
In total, it took about 2 days, and a loooot of it is debugging the Vuelidate import problem, rerunning/adjusting system-specs, as we also went from Apparition to Cuprite test runner. Hopefully, the next person running into this post will have a nicer experience.
I am confident that will amortize in the future with much faster startup times and functioning HMR, but getting rid of 6000 LOCs of yarn.lock seems to be already a great prospect for happiness...
Also, big thanks to @ElMassimo for running the whole vite-ruby ecosystem!
Beta Was this translation helpful? Give feedback.
All reactions