Javascript Angular 2导入未添加到生成的节点_模块

Javascript Angular 2导入未添加到生成的节点_模块,javascript,angular,build,node-modules,Javascript,Angular,Build,Node Modules,我在MS IE 10/11中运行的某些组件出现问题。 根据Angular.io()中的这篇文章,我需要导入一个外部脚本 <script src="node_modules/core-js/client/shim.min.js"></script> 我把它放在了index.html中 <!doctype html> <html> <head> <meta charset="utf-8">

我在MS IE 10/11中运行的某些组件出现问题。 根据Angular.io()中的这篇文章,我需要导入一个外部脚本

<script src="node_modules/core-js/client/shim.min.js"></script>

我把它放在了index.html中

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <base href="/">
        <link rel="icon" type="image/x-icon" href="/assets/favicon.ico">
        ...
        <script src="../node_modules/core-js/client/shim.min.js"></script>
    </head>
    <body>
        <app-root></app-root>
    </body>
 </html>

...
但是,当我为生产构建时,它不会将其添加到构建中,它只是将其留在那里,在运行应用程序时以脚本未找到错误结束

我可能错过了什么,但我不知道是什么


提前谢谢

.angular cli.json
文件中,找到(或创建)应用程序定义中的
“scripts”
键,并在数组中为
shim.js
脚本添加一个条目,例如:

"scripts": [
  "../node_modules/core-js/client/shim.min.js"
],
重新启动您的
ng服务
或重建您的捆绑包,您就可以开始了


希望这有帮助

您需要在angular-cli.json文件中添加CSS文件和JS文件。如果在这种情况下不使用angular cli,则需要在正在使用的构建工具中进行配置

angular不会读取index.html文件以确定需要捆绑哪些依赖项。当您进入构建阶段时,index.html文件基本上未被触及。必须通过适当的系统通道将其指定为依赖项。然而,要做的细节实际上可能差异很大,这取决于构建的管理方式。您正在使用angular cli吗?您是否下载了angular seed项目(可能使用webpack或systemjs)?基本上,有多种方法来管理构建过程,答案取决于如何管理构建。我将Angular Cli与webpack结合使用,这是一个从头开始的大型应用程序构建。