Fails to init pinia store on build with pnpm@7 #1741
Replies: 3 comments 1 reply
-
@posva I guess it's not a bug in pinia since you converted it to Q/A, is that right? Is there a recommendation how to use it in monorepo setup and pnpm? As there seems to be some regression :-/ |
Beta Was this translation helpful? Give feedback.
-
Just found out bundled code includes two copies of pinia code, causing this issue. @posva is there a way to prevent this? |
Beta Was this translation helpful? Give feedback.
-
this was my issue too, if you're using vite you need to get vite to dedupe duplicate dependencies. e.g
it removes the other included pinia dependency and resolved this for me |
Beta Was this translation helpful? Give feedback.
-
Reproduction
https://github.com/lukashroch/pinia-pnpm-debug
Steps to reproduce the bug
it fails with:
Expected behavior
Pinia stores should be initialized with no error.
Actual behavior
Built vue app for production fails to load pinia stores:
Additional information
I'm trying migrate from pnpm@6 to pnpm@7 and stumbled upon pinia store init fail.
This works without any issues with current outlined setup in repo and pnpm@6. But when upgraded to pnpm@7, vue app production built fails with above error. Though dev server (
pnpm dev
) still works with no issues.Example is monorepo with:
packages/ui
includes some UI shared code, including boostraping pinia and common stores.Issue seems to be related that the code is pulled from packages area. If I gradually move the code to the app itself,
i.e. swapping commented import in these three parts:
It then starts to work. Though this would prevent from sharing any common UI code between couple of vue.js apps.
I'm not sure if it's pinia bug or something else as this worked with pnpm@6. Pnpm@7 works a bit differently with resolving deps, like peers, but none are missing as far as I can tell. I tried also auto peer install or few hoisting pnpm configs but with no luck.
Beta Was this translation helpful? Give feedback.
All reactions