From vuex to pinia
I will mostly talk about why and how my team and I made the switch from vuex
to pinia
.
I will not describe in detail:
- what pinia
is,
- how it compares to vuex
,
- how to migrate a vuex
store module to a pinia
store.
Feel free to check the pinia docs “Comparison with vuex” or this post from Mariappan: https://medium.com/front-end-weekly/what-makes-pinia-the-new-default-d29c5359de15
My team and its project
Our codebase is about 2 years old, still on Vue 2 (v2.7), using Options API, mostly written in JavaScript, and with 2–3 developers full time on it.
Before starting our transition to pinia
, we had 15 vuex
modules.
So I’d say it’s not a huge project, but not small either.
About 6 months ago, we started to write more and more TypeScript code, especially for all files other than components (models, actions, services…) thanks to Vite
and esbuild
transpiling everything for you in a transparent way.