Modifying code in a composable throws error 500 composable is not defined
Hi all, i'm writing a composable on a nuxt 3 module.
*Problem
When I compile the app for the first time the composable work pretty good, but when I change code inside composable and hot reload acts the app throws an error 500 saying that my composable is not defined.
Then i need to restart the app compiling again and all works perfect again.
* Minimal reproduction
Here I provide a minimal reproduction to that error, you could try defining a variable or add/remove a console.log and you should see the error.
https://stackblitz.com/edit/github-1hay52?file=composables%2FuseNetwork.js
I also checked that is there a post in stackoverflow but no solutions was provided.
https://stackoverflow.com/questions/75942987/nuxt-3-code-change-in-composable-generates-referenceerror/76497211?noredirect=1#comment134880834_76497211
Any ideas of what i'm doing wrong or missing?
Stack Overflow
Nuxt 3 - code change in composable generates ReferenceError
Introduction
I am using nuxt for some small university projects, but I mention something that is quite anoying, but I could not find any ticket on the Nuxt 3 github or any mention on stackoverflow.
1 Reply
Hey Pin, I thought I was going crazy over a mistake of mine, but I'm experiencing the same issue here, you're not alone ^^
I've tried to look about it for a bit:
- Doesn't seems like a regression, tried on
3.5.3
(latest), 3.5.0
, 3.4.3
, 3.3.3
without luck
- Doesn't seems like something on unimport
, tried with dependency overrides from 3.0.0
to 3.0.8
- Doesn't seem related to top-level App.vue
, same when using page directory
I'll see with the team what's going on here, I still feels like it's something silly, but I'll open an issue if it leans towards a real issue 🤔
Tracked it there: https://github.com/nuxt/nuxt/issues/21673