我还能在哪里在angular-cli中声明包含的脚本? [英] Where else can I declare included scripts in angular-cli?

查看:50
本文介绍了我还能在哪里在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以单独的捆绑软件输出脚本,则可以使用

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆