且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Firebase“将资源解释为样式表,但以MIME类型text/html传输"

更新时间:2022-04-10 21:35:14

Sidney疯狂地猜测着他.捆绑的index.html中指向样式表和图像的链接不正确.Parcel引用了dist文件夹,在该文件夹中,他应该直接引用了这些文件.我能够手动更改来自的链接

Sidney was wright with his wild guess. The link to the stylesheet and the images weren't correct in the bundled index.html. Parcel referred to the dist folder, where he should have referred directly to the files. I was able to manually change the links from

<link rel="stylesheet" href="/dist/natalem-20.css">

<link rel="stylesheet" href="/natalem-20.css">

然后一切正常.

由于Firebase无法找到正确的样式表,因此他只是将HTML作为.css文件发送回去.因此,控制台中没有404错误,但是警告了

Because Firebase wasn't able to find the correct stylesheet, he just sent back the HTML as .css - file. Because of that, there was no 404-error in the console but the warning

资源被解释为样式表,但以MIME类型text/html传输

Resource interpreted as Stylesheet but transferred with MIME type text/html

因此,要解决此问题,只需更改捆绑的index.html中的路径,或者(我现在要执行的操作)是要弄清楚如何在宗地配置中更改此路径.

So to fix the problem, just change the path in the bundled index.html or (what I'm gonna do now) is to figure out, how to change this over the Parcel config.

非常感谢Sidney的帮助!给你做道具!

Thanks a lot to Sidney for the help! Props to you!

真诚的,

拉斐尔