Import vite library with Pinia into Nuxt project throws #2216
Replies: 3 comments 3 replies
-
@andredewaard - I am facing the exact same issue. Have you looked at nuxt/nuxt#19847 (comment)? It suggests adding the following config to export default defineNuxtConfig({
modules: ['@pinia/nuxt'],
nitro: {
alias: {
pinia: 'pinia'
}
}
}); This seems to resolve the issue locally on build ( I created a minimal repo:
I also opened issues: |
Beta Was this translation helpful? Give feedback.
-
We have the exact same issue. |
Beta Was this translation helpful? Give feedback.
-
@kimbaudi @DylanArens I don't know if it helps solving your problem, but i had this issue also in my library. |
Beta Was this translation helpful? Give feedback.
-
I have a personal library that handles authentication.
It will be used it multiple projects. (Vite/Nuxt).
The library handles the state with Pinia and is build with Vite where Pinia is set as an external dependency
Vite.config
Now when i want to use this library in my Nuxt project it works fine during development. When building for production however it throws an error.
Installing
@pinia/nuxt
and/orpinia
in the Nuxt project doesn't seem to solve this issue.PS: The library it a private library so is not accessible for others.
Beta Was this translation helpful? Give feedback.
All reactions