admin管理员组文章数量:1406913
I am working on a react project using vite v5.2.0
. Everything was working fine until I suddenly got this error:
${mod.id}:55061 Uncaught SyntaxError: Identifier '__vite__injectQuery' has already been declared (at ${mod.id}:55061:1)
I don't understand what happened, but my entire screen went white, and I am unable to do anything.
I am working on a react project using vite v5.2.0
. Everything was working fine until I suddenly got this error:
${mod.id}:55061 Uncaught SyntaxError: Identifier '__vite__injectQuery' has already been declared (at ${mod.id}:55061:1)
I don't understand what happened, but my entire screen went white, and I am unable to do anything.
Share Improve this question edited May 2, 2024 at 16:56 Shmack 2,3512 gold badges20 silver badges29 bronze badges asked May 2, 2024 at 9:43 FardeenFardeen 211 silver badge3 bronze badges 3- Hi @Fardeen, was this working previously? If it is throwing this error after a change, what is that change? If no changes were made, check node/npm/yarn versions and reinstall packages.. what all have you checked for, so far to debug this issue? – James Ashok Commented May 2, 2024 at 10:13
- 1 Thanks for replying;I accidently import the "preview" from the vite in one of my ponent which is causing this error.After removing the import statement my application starts working – Fardeen Commented May 3, 2024 at 12:53
- it may be due to an unintentional/unwanted import in one of your files; that was the issue found (now resolved) in this github thread – lefrost Commented May 13, 2024 at 2:28
4 Answers
Reset to default 5i have got the same issue, and i solved it by just removing an unintentionally imported vite module.
import { send } from 'vite'; I have imported this module by mistake and that's why it was giving me the error. You can remove the file(You may import another type of file. So it is better to type ctrl+shift+f and search "from 'vite'".Then you can delete the redundant imports.)
The reasons you are getting the error might be due to accidentally importing unwanted things from other packages. In my case, I downloaded a build from 'vite', which I didn't need for my entire project. After deleting that line, everything returned to normal. The solution is to find the unnecessary package and delete it.
search
import { build } from "vite"
using ctrl
+shift
+f
and remove it from the code.
本文标签:
版权声明:本文标题:javascript - ${mod.id}:55061 Uncaught SyntaxError: Identifier '__vite__injectQuery' has already been declared (a 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744998160a2636806.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论