javascript - Angular 12 将外部脚本加载为类型模块
问题描述
是否可以将 Angular 设置为加载angular.json
下面architect/build/options/scripts
定义的外部脚本type="module"
?
运行 Angular 时,我可以看到自动注入的脚本标签,如下所示:
<script src="runtime.js" type="module"></script>
<script src="polyfills.js" type="module"></script>
<script src="styles.js" type="module"></script>
<script src="scripts.js" defer></script>
<script src="vendor.js" type="module"></script>
<script src="main.js" type="module"></script>
有scripts.js
一个 defer 属性,但没有type="module"
。我正在尝试将通过 npm 安装的 Stencil JS Web 组件加载到我的应用程序中。Stencil 组件脚本需要作为模块加载,否则其他导入将不起作用。