错误信息
使用 Vite 打包的网页白屏,控制台报错。
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec.
原因
MIME 的类型错误,一般是本地 windows 下开发会遇到的问题。我就是在Windows 下用 Python 内置的 http.server
打开后遇到的。
解决方案
将打包后的文件部署在正式的服务器环境下(如 Nginx、Apache)。
参考资料
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)