prazdevs / pinia-plugin-persistedstate

💾 Configurable persistence and rehydration of Pinia stores.
https://prazdevs.github.io/pinia-plugin-persistedstate/
MIT License
2.13k stars 121 forks source link

[Nuxt@3.7.0] `[vite-node] [ERR_LOAD_URL] pinia-plugin-persistedstate` #236

Closed telmoenmartins closed 11 months ago

telmoenmartins commented 1 year ago

Describe the bug

With a simple setup of pinia and pinia persisted state on nuxt3 this error appears, any ideal why?

Reproduction

https://stackblitz.com/edit/nuxt-starter-crtmzw?file=nuxt.config.ts

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 18.21 GB / 31.89 GB
  Binaries:
    Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (116.0.1938.69)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Validations

prazdevs commented 1 year ago

Ah shit, that's annoying. Problem appears on Nuxt@3.7.0+

Could this be related to vite@4.4 🤔

I'll try to look into that.

prazdevs commented 1 year ago

Okay here's a workaround, add this to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
  build: {
    transpile: ['pinia-plugin-persistedstate'],
  },
});
schalkneethling commented 1 year ago

Okay here's a workaround, add this to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
  build: {
    transpile: ['pinia-plugin-persistedstate'],
  },
});

This works for me. Thanks, @prazdevs

prazdevs commented 1 year ago

Could you try again with

"@pinia-plugin-persistedstate/nuxt": "^1.1.1",
"@pinia/nuxt": "^0.4.11",
"nuxt": "^3.7.3"

I have it working locally (it worked with 3.7.0 too tho). Does it work locally ?

telmoenmartins commented 1 year ago

Could you try again with

"@pinia-plugin-persistedstate/nuxt": "^1.1.1",
"@pinia/nuxt": "^0.4.11",
"nuxt": "^3.7.3"

I have it working locally (it worked with 3.7.0 too tho). Does it work locally ?

No luck, only working with the transpile option for now

prazdevs commented 1 year ago

I'll try to see if i can add transpilation to the module itself and it works, so there's no need to add it afterwards.

ashomurodov commented 1 year ago

Okay here's a workaround, add this to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
  build: {
    transpile: ['pinia-plugin-persistedstate'],
  },
});

Works for me. Thank you, @prazdevs :)

sunupf commented 1 year ago

Hi, I try the workaround, it's works. but somehow the state is not persist. I check my cookies it's empty. and when I reload the state refreshed.

It's only me or it's also happened to you guys?

prazdevs commented 11 months ago

Everything seems to be working fine with nuxt@3.8.2 without having to transpile 👍 feel free to reopen is issue somehow reappears

kevinlonigro commented 10 months ago
build: {
    transpile: ['pinia-plugin-persistedstate'],
  },

Just encountered the issue with following packages, the build transpile option fixes it:

prazdevs commented 10 months ago

thanks for the headsup, i kinda want to do a new module version and make it cleaner, but i have lots of stuff on the plate, and personal/health issues, so it has to wait.

as long as there is a workaround and it can work, it's ok ^_^

SheikhElMoctarG commented 9 months ago
build: {
    transpile: ['pinia-plugin-persistedstate'],
  },

It's working ❤️

ergs22 commented 4 months ago

Okay here's a workaround, add this to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
  build: {
    transpile: ['pinia-plugin-persistedstate'],
  },
});

THANKSS. 13/07/2024 still working

thylaakari commented 1 day ago

Okay here's a workaround, add this to nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt'],
  build: {
    transpile: ['pinia-plugin-persistedstate'],
  },
});

doesn't work

BaldFabi commented 20 hours ago

Have a look into https://github.com/vuejs/pinia/issues/2822. Try to run npm i pinia --force