没有配置加载器用于“.html”文件:index.html Vitejs

huangapple go评论66阅读模式
英文:

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 &quot;.html&quot; files: index.html

    &lt;stdin&gt;:1:7:
      1 │ import &quot;D:/Projects/C#/DAINIS/vueapp/index.html&quot;
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    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 (&lt;anonymous&gt;)
    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.

huangapple
  • 本文由 发表于 2023年6月2日 01:38:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76384397.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定