最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ${mod.id}:55061 Uncaught SyntaxError: Identifier '__vite__injectQuery' has already been declared (a

programmeradmin1浏览0评论

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
Add a ment  | 

4 Answers 4

Reset to default 5

i 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论