"Symbol() not found" when shipping library #856
-
Hi, So I've noticed that I get a warning that the injection Am I doing something wrong? This is an example of how I use the stores:
Everything works fine, no issues whatsoever - it's just the pesky warning that will not leave me alone. From what I saw Pinia uses Thanks for taking the time to read this and have a nice week 🦾 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
Hi, I'm glad you are enjoying pinia! I don't understand the error you are seeing or what you are trying to do. You should share a more complete example but it looks very different from what is indicated in docs The Symbol not having a name is just for a better size. |
Beta Was this translation helpful? Give feedback.
-
What I'm trying to do is create a store outside of an actual app but inside a component tree.
That's basically what I am shipping in my library; There is no I'm sort of doing it as described in the Testing section of the docs:
Though 'm doing it once when calling
It does work as I would expect it to, so there's no issue in functionality that I could detect. Thanks a lot for your help :) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I personally suggest using If you still think a store will help you, you need to add pinia as a peer dependency of the project, make sure it is marked as an external lib when bundling your lib (you can check this by verifying your lib has imports from pinia in its code), and let the user call Calling It's also important to note that having multiple pinia instances in one app is dangerous because there can only be one active pinia at a time and if the wrong pinia is active when |
Beta Was this translation helpful? Give feedback.
I personally suggest using
inject
/provide
for libraries if you need to pass around state. It's lighter and should cover most of the cases. (I didn't get you were talking about a library and not an Application)If you still think a store will help you, you need to add pinia as a peer dependency of the project, make sure it is marked as an external lib when bundling your lib (you can check this by verifying your lib has imports from pinia in its code), and let the user call
app.use(pinia)
themselves.Calling
setActivePinia()
works for testing stores, not for apps because it will skip any plugins and that's why there iscreateTestingPinia()
.It's also important to note that having multiple p…