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;   重载配置,强刷网页之后,发现可以了。这个解决方案我在网上没搜到,所以记录下来,如果其他人遇到类似问题可以很快解决。