vuejs / pinia

🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
https://pinia.vuejs.org
MIT License
13.17k stars 1.06k forks source link

Nuxt + Composition API not working #470

Closed yassilah closed 3 years ago

yassilah commented 3 years ago

Simply cloning https://github.com/posva/pinia-example-nuxt and running it throws an error because VueCompositionAPI is not yet installed when Pinia is initiated.

posva commented 3 years ago

@yassipad did you find a solution? I haven't been able to check it yet but it looks like the Composition Api plugin is no longer installed in time

posva commented 3 years ago

Using the @nuxtjs/composition-api version 0.22.4 seems to work. Things are working at this commit: https://github.com/posva/pinia-example-nuxt/tree/c1769a7e524ffcc980385e8248f6705ddcc805b0

I ended up removing @vue/composition-api and Pinia from transpile option and things are working again 👍 I updated the example too

yassilah commented 3 years ago

Aha actually I think I did but didn't realize this is what fixed it: I simply removed the build: transpile option from nuxt.config.js and everything works as expected.