网页报错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.

vue的项目发布成dist后,放到服务器上 出现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.这个错误。

但是在本地是可以运行的,在linux服务器上却不行。幸运的是,这个dist项目我在另一个linux服务器上可以部署并且打开,所以我怀疑是nginx配置问题。

抱着试一试的态度,我在http下加了 include       mime.types;   重载配置,强刷网页之后,发现可以了。这个解决方案我在网上没搜到,所以记录下来,如果其他人遇到类似问题可以很快解决。

 

 

 

 

 
posted @   超难微猫  阅读(15447)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示