-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pinia nuxt version 0.6.0+ causes error when used with pnpm monorepo #2820
Comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
I did some research, and the problem persists even with upgraded Nuxt and pnpm. The cause of the problem is the removal of the alias for pinia in 65031ee import { fileURLToPath } from 'node:url'
import path from 'node:path'
const rootDir = fileURLToPath(new URL('../..', import.meta.url))
export default defineNuxtConfig({
modules: [ '@pinia/nuxt'],
alias: {
pinia: path.resolve(rootDir, 'node_modules/pinia/dist/pinia.mjs')
}
}); Or exclude pinia from vite optimization: export default defineNuxtConfig({
modules: [ '@pinia/nuxt'],
vite: {
optimizeDeps: {
exclude: ['pinia']
}
},
}); @danielroe I would like some help with this matter: in my tests, I have two copies of pinia in non monorepo nuxt applications. I still don't understand why this part of the Pinia module is so flaky, and I suppose it's more of an issue of Vite than Nuxt. But I imagine you have seen this issue often enough to guide me in the right direction (and add a note comment so my future self does not forget 😅) |
Using the |
I'm still not 100% sure of the fix being the right solution so I will keep this open until then |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
I've updated @nuxt/pinia to 0.7.0 last week and started running into this issue. Downgrading to 0.6.1 makes everything work again. Additional data points:
EDIT: So 0.6.1 works in development (at least for me), but after a deploy to staging "everything" was broken. Only after downgrading to 0.5.5 did a deployed build work again. |
Hello, today I've updated from v0.5.5 to v0.7.0 and couldn't run the project. This is the error I'm receiving "[nuxt] [request error] [unhandled] [500] Cannot find module '/.output/server/node_modules/pinia/dist/pinia.mjs' imported from /.output/server/chunks/build/server.mjs" and when I check the file in node module there is only pinia.prod.cjs file. nuxt: 3.13.2 also I use pnpm Thank you |
I think that to fix this we might release a new version that removes the compatibility with Vue 2.6 but keeps Vue 2.7. This will allow removing some peer dependencies that nom isn't able to support (like other package managers do) |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This should allow the nuxt module to install pinia if needed Fix #2820
This was partially fixed en #2846 but requires unjs/nypm#165 to be merged and released so adding the Nuxt module also adds |
this should now be resolved in latest nuxi! 🎉 |
Can this issue be reopened? It still persists after upgrading to I'm also using a Thanks! |
If you have a boiled down without Apollo or other libraries, I can take a look |
I'll try to put together a repro for you over the weekend, much appreciated! |
Maybe try the following? In I tried to add |
Reproduction
https://stackblitz.com/~/github.com/kalvenschraut/pinia-nuxt-pnpm-monorepo-issue
Steps to reproduce the bug
To see issue do
can then downgrade @pinia/nuxt to 0.5.5 and run same commands to see it working. Can also upgrade to 0.6.1 to verify still not working
Expected behavior
Page to load and show the users name from the user store
Actual behavior
Additional information
In prod builds on my personal site where I first initial saw this was seeing vueDemi.effectScope is not a function error. Downgrading back to 0.5.5 for now until direction can be given
The text was updated successfully, but these errors were encountered: