🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support
by vuejs6 of 6 standards met
Reproduction https://github.com/antoinezanardi/nuxt-pinia-testing Steps to reproduce the bug 1. Clone the reproduction repository. 2. Run 3. Run Expected behavior The test should pass as the method from store is called when the component is mounted. Actual behavior When using the util method in a Nuxt project, the stores are not correctly mocked. I created a simple test which expect a method from a store to be called when the component is mounted. However, the test fails with the following logs : Additional information I'm pretty sure that the nuxt module is the source of the problem. If you comment the module in the at the root of the project, the test passes.
What problem is this solving I'm trying to use pinia in a microfrontends architecture, and we are planing to use importmaps to solve duplication of bundling dependencies. So we're mapping pinia to https://cdn.jsdelivr.net/npm/pinia/dist/pinia.esm-browser.js But it comes with some issues. Pinia imports vue-demi, i think it's great that pinia support both Vue 2 and 3, but this hurts the esm imports as i will need to add an import map for vue-demi also It also imports @vue/devtools-api, which is great in development, but could probably be avoided in prod I have a working example https://jsfiddle.net/porfirio/qh8pf5xb/22/ Proposed solution Have a new bundle without vue-demi and pointing directly for vue (3) Probably create 2 bundles, one for prod without devtools, other for dev. The pinia-esm-vue3 bundle, should only have the dependency on vue Describe alternatives you've considered It is possible to make it work, as-is, but it brings a lot of configuration that needs to be added
Repository: vuejs/pinia. Description: 🍍 Intuitive, type safe, light and flexible Store for Vue using the composition api with DevTools support Stars: 14490, Forks: 1175. Primary language: TypeScript. Languages: TypeScript (73.5%), Vue (18.7%), JavaScript (5.3%), CSS (1.9%), HTML (0.5%). License: MIT. Homepage: https://pinia.vuejs.org Topics: composition-api, ssr, store, vue, vuex. Latest release: v3.0.4 (3mo ago). Open PRs: 14, open issues: 19. Last activity: 2d ago. Community health: 100%. Top contributors: posva, dependabot[bot], dependabot-preview[bot], renovate-bot, pi0, renovate[bot], danielroe, nicodevs, idorenyinudoh, skirtles-code and others.
TypeScript
Last 12 weeks · 25 commits
Reproduction N/A Steps to reproduce the bug There is a related issue https://github.com/vuejs/devtools/issues/672 The reproduction steps are there. Expected behavior Call immediately instead of calling it after . otherwise devtools cannot read at mounted. Actual behavior Call after someone calls Additional information _No response_
Another attempt to contribute to #1394 🙂 In tests, I'm getting various warnings because those tests are using duplicated names for stores. I'm not sure how to approach this in a smart way, appreciate any help or feedback. Tried this approach to avoid messing with registry property. What are your thoughts? Closes #1394
Reproduction https://stackblitz.com/edit/github-s7r74z5k-h26h8xm3?file=package.json%2Cnuxt.config.ts%2Csrc%2Fapp.vue%2Csrc%2Fstores%2Ftest.ts Steps to reproduce the bug 1. Just open the preview of port 3000 Expected behavior Resolve auto import from Actual behavior Additional information Rollback to : https://stackblitz.com/edit/github-s7r74z5k-awhgopug?file=package.json%2Cnuxt.config.ts%2Csrc%2Fapp.vue%2Csrc%2Fstores%2Ftest.ts, or manually set in will fix this. It's seems a regression since https://github.com/vuejs/pinia/pull/3035/changes#diff-be7ecc6bc17358942938e025d26bee5e5c3664db77e2be717b644d96d3222172R81