Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

vue3+vite项目中,在.vue文件内部引入了.js文件后报错

百度了好久大家都是在打包后出的问题,但我这里是在引入文件后报的错,看了下控制台提示了引入js文件对应的页面的问题:

vue-router.esm-bundler.js:72 [Vue Router warn]: uncaught error during route navigation:

TypeError: Failed to fetch dynamically imported module: http://172.18.111.201/src/views/ai/ocr/template/index.vue?t=1661134606509

最终锁定引入的a.js代码内部还自定义导入了b.js文件的方法,但是导入的路径不对,找不到b.js文件导致的错误(不太好根据报错排查,仅提供一个思路吧)。

 

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐