基本情况:
插件市场引入第三方个人插件,插件中的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');
}
0 个回复