angular-cli --prod(AOT)polyfills模块不会删除Angular 2编译器

问题描述 投票:3回答:2

我运行以下命令来获取stats.json

 node --max-old-space-size=4096 .\node_modules\@angular\cli\bin\ng build --prod --stats-json

然后使用WebPack Bundle Analyzer来检查我的项目。

当运行AOT(用--prod标志隐式)时,我看到编译器被捆绑在我的polyfills输出中,这不是我预期的,因为我正在运行Ahead of Time Compilation。

我应该更改什么来阻止这个编译器被捆绑?或者我应该在哪里检查?

Webpack Bundle Analyzer output

angular webpack angular2-aot
2个回答
1
投票

好的,我发现了问题 - 呃。

有人直接向import '@angular/compiler/bundles/compiler.umd';添加了pollyfills.ts


0
投票

你还应该添加--aot flag。

ng build --prod --aot.

你也可以用aot运行服务

ng serve --prod --aot.
© www.soinside.com 2019 - 2024. All rights reserved.