英文:
No loader is configured for ".html" files: index.html Vitejs
问题
抱歉,你的内容包含了一些代码部分,我将只返回翻译好的文本,不包括代码。以下是翻译后的内容:
你好,我遇到了一个问题。我正在使用Visual Studio 2022,并在一个解决方案中创建了两个项目。一个用于后端(ASP.NET),另一个用于前端(vuejs和vite)。问题开始于此。我使用了npm create vue@3命令来创建vue项目。它成功启动了,但是当我在我的解决方案项目的前端文件夹中执行相同的操作时,vite会抛出错误,说找不到index.html文件。
错误信息如下:
错误:无法从以下位置扫描依赖项:
D:/Projects/C#/DAINIS/vueapp/index.html
X [错误] 未配置任何加载器以处理“.html”文件:index.html
<stdin>:1:7:
1 │ import "D:/Projects/C#/DAINIS/vueapp/index.html"
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
为了确保项目没有改变,我保持了原样。项目结构如下:
项目结构
我尝试了在Stack Overflow中找到的解决方案这里和这里,但仍然没有解决问题。
英文:
Greetings I have problem. I am using Visual studio 2022 and created two projects there for one solution. One for back-end (ASP.NET) and the second one for fron-end (vuejs and vite). So here starts the problem. I used npm create vue@3 command to create vue project. And its launched fine , but when I did same thing in folder of front-end in my sln project vite throws error what it can not find index.html file
Error: Failed to scan for dependencies from entries:
D:/Projects/C#/DAINIS/vueapp/index.html
X [ERROR] No loader is configured for ".html" files: index.html
<stdin>:1:7:
1 │ import "D:/Projects/C#/DAINIS/vueapp/index.html"
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
at failureErrorWithLog (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1638:15)
at D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1050:25
at runOnEndCallbacks (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1473:45)
at buildResponseToResult (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1048:7)
at D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1060:9
at new Promise (<anonymous>)
at requestCallbacks.on-end (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:1059:54)
at handleRequest (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:725:19)
at handleIncomingPacket (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:747:7)
at Socket.readFromStdout (D:\Projects\C#\DAINIS\vueapp\node_modules\esbuild\lib\main.js:675:7)
Just in case I did not changed project it is as is.
Project structure
Error dump example
I tried solutions found here and here in stack overflow but still no luck
答案1
得分: 4
问题出在您的文件路径中的#
符号
D:/Projects/C#/DAINIS/vueapp/
我不知道这会导致失败的技术原因,但如果您将其删除,项目应该可以运行。
英文:
The issue is the #
symbol in your file path
D:/Projects/C#/DAINIS/vueapp/
I don't know the technical reason why this causes it to fail, but if you remove it, the project should run.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论