Skip to content
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

Hot Module Reload breaking on nuxt 3 vue 3 with Pinia #90

Open
idlethumbs opened this issue Jan 11, 2024 · 2 comments
Open

Hot Module Reload breaking on nuxt 3 vue 3 with Pinia #90

idlethumbs opened this issue Jan 11, 2024 · 2 comments

Comments

@idlethumbs
Copy link

idlethumbs commented Jan 11, 2024

I'm submitting a ... (check one with "x")

[ x] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • Vue.js version : 3.3.x
  • Browser name and version : Chrome|Firefox|Edge
  • latest chrome
  • This package version : 3.1.2
  • "nuxt": "^3.9.0",
  • pinia: ^2.1.7

Current behavior

when importing useToast; HMR stops working in my nuxt app, browser refresh must be forced,
HMR updates still appear in the terminal.

upon removing the line with import {useToast} from 'vue-toast-notification'
and restarting server HMR starts working again as expected.

<script setup lang="ts">
import { useToast } from 'vue-toast-notification';
</script>

Expected behavior

HMR is not affected by importing useToast

Minimal reproduction of the problem with instructions
Upon investigation - discovered this due to versioning conflicts,

Pinia documentation suggests adding :

"overrides": {
  "vue": "latest"
}

to package.json for nuxt apps. This seems to cause HMR to break when using vue-toast-notifications.
updating to leave vue-toast-notification dependencies unchanged:

  "overrides": {
    "vue": "latest",
    "vue-toast-notification": {
      "vue": "^3.0"
    }
  },

fixes the issue and HMR works again

I'm not sure whether to update pinia fix to apply only to pinia (e.g. "pinia": { "vue" : "latest" }) or do the above, both will work but I believe the pinia scoped latest only results in more versions of vue in the project than necessary.

@idlethumbs idlethumbs changed the title Hot Module Reload breaking on nuxt 3 vue 3 Hot Module Reload breaking on nuxt 3 vue 3 with Pinia Jan 11, 2024
@ankurk91
Copy link
Owner

Right now, I dont have time to re-produce the issue

@idlethumbs
Copy link
Author

idlethumbs commented Jan 12, 2024

@ankurk91
when i have time i will create a repo with minimum repro, it should be a fresh nuxt app (npx nuxi init) and then adding the vue version override that pinia asks for, we shouldn't need to install pinia to re-create the problem, but i can add it as it's relevant.

the problem with an online sandbox/codepen etc is I'm not sure if they implement their own version of HMR when code changes are made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants