荔枝荔枝荔枝
荔枝荔枝荔枝
  • 发布:2025-03-19 10:20
  • 更新:2025-03-19 10:20
  • 阅读:10

Failed to load module script: Expected a JavaScript module ... MIME type of "text/html"...

分类:HBuilderX

基本情况:

插件市场引入第三方个人插件,插件中的html文件中有内容需要配置i18n,因此需要引入项目的相关js文件,但引入js文件之后报错:

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.

百思不得其解,希望各位大佬予以解惑,感谢!

部分代码如下:

// xxx.html 文件中  
<script type="module">  
    import a from './test.js';  
    console.log(a());  
</script>  
<script type="text/javascript">  
    // 插件代码  
</script>
// test.js  
export default function a() {  
    console.log('aaaaa');  
}
2025-03-19 10:20 负责人:无 分享
已邀请:

要回复问题请先登录注册