我正在玩stencil 我到目前为止所做的事情:
- 在模板中创建了一个组件
- 发布到 npm
- 创建了一个角度项目
- 将模板组件安装到 Angular 项目中
- 在 index.html 文件中添加了 component.js 文件
当我添加
<script src="/node_modules/stencil-poc-ng/dist/mycomponent.js"></script>
然后浏览器控制台给出以下错误:
GET http://localhost:4200/node_modules/stencil-poc-ng/dist/mycomponent.js 404 (Not Found) localhost/:1 Refused to execute script from ' http://localhost:4200/node_modules/stencil-poc -ng/dist/mycomponent.js ' 因为它的 MIME 类型 ('text/html') 不可执行,并且启用了严格的 MIME 类型检查。