我还可以在哪里声明 angular-cli 中包含的脚本? [英] Where else can I declare included scripts in angular-cli?
问题描述
在 angular-cli.json
我有:
"polyfills": "polyfills.ts"
"scripts": ["script1.ts"]
我想专门为 ie11
添加另一个 polyfill 脚本,然后我可以在最终构建时将其包含在条件注释中,以减少其他浏览器的加载时间.
I want to add another another polyfill script for ie11
specifically, which I can then wrap in a conditional comment upon final build, in order to decrease load times on other browsers.
我将如何包含这样一个脚本,使其在运行时与项目的其余部分一起编译,但不会捆绑到上述任何一个中?
How would I go about including such a script so it compiled with the rest of the project at run time but was not going to be bundled into either of the above?
推荐答案
如果您希望 cli 在单独的包中输出脚本,您可以使用 global-scripts 像:
If you want cli to output the script in a separate bundle you can use global-scripts like:
"scripts": [
{ "input": "../node_modules/module-name", "output": "module-custom-name", "lazy": true}
],
当您指定 "lazy": true
cli 将创建一个单独的文件,该文件将仅包含您要有条件加载的模块.
When you specify "lazy": true
cli will create a separate file that will contain just your module you want to load conditionally.
这篇关于我还可以在哪里声明 angular-cli 中包含的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!