Component that uses pinia in library mode can't be imported and reused in another app #1073
-
ReproductionI created a simple counter component that uses pinia to manage state: https://github.com/leopsidom/pinia-lib and build it in Then I try to import the package from another Stackblitz app here: https://stackblitz.com/edit/github-yjj6ch?file=src/App.vue Steps to reproduce the behavior
Expected behaviorThe component should work Actual behaviorIt throws a pinia error when importing the component from anther app
Additional information |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 16 replies
-
you need to mark |
Beta Was this translation helpful? Give feedback.
-
Is there any other way to avoid introducing |
Beta Was this translation helpful? Give feedback.
-
I encountered same issue today and can confirm that this is not working even after marking |
Beta Was this translation helpful? Give feedback.
-
@posva Hello. I've catched error So I've tried to create simple store from examples from pinia docs. Result was same - no error in dev mode but error in production mode. Version of pinia I think there is something wrong in |
Beta Was this translation helpful? Give feedback.
you need to mark
pinia
as an external module in the bundling config. For vite that should bebuild.rollupOptions.external: ['pinia']