getodk / central-frontend

Vue.js based frontend for ODK Central

Home Page:https://docs.getodk.org/central-intro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move from Vue CLI to Vite

matthew-white opened this issue · comments

Vue CLI is now in maintenance mode, so I think we should start planning to move to Vite.

Some of the performance issues described in Why Vite? sound familiar. In particular, right now it feels like build time is reducing the cadence of testing locally for us: even if tests themselves run quickly, it takes some seconds to start them.

I had interpreted a comment on a Vue I18n repository here as meaning that Vue I18n will stop working with Vue CLI. But looking at it slightly more closely, I think they're still planning to support webpack, just with something other than @intlify/vue-i18n-loader. Though as @sadiqkhoja has noted, vue-cli-plugin-i18n also doesn't seem to be well maintained.

We don't have much custom webpack configuration: I think what little there is is just in vue.config.js. Hopefully that will ease the transition to Vite.

Probably the hardest part of transitioning to Vite will be figuring out testing. Will we still be able to use Karma? Right now we use karma-webpack to get Karma working with webpack. Vite seems to use Rollup, and from a glance, there do seem to be ways to get Karma working with Rollup. That said, I have no particular love of Karma. Since Karma is no longer recommended within the Vue community, some testing things haven't always worked out-of-the-box for us. Looking at the Vue 3 testing guide, it looks like Vitest is the current recommendation. It'd be nice though if we could somehow sequence things so that we don't have to transition off Vue CLI and Karma at the same time. Could we move from Vue CLI to Vite in one step, initially setting up Karma to work with Rollup, then in a next step move from Karma to something like Vitest?