如何将提前编译器与angular cli webpack一起使用 [英] how to use ahead-of-time compiler with angular cli webpack
问题描述
有没有办法将AOT与角度cli一起使用?
is there a way to use AOT with angular cli?
我已经安装了模块(@ angular/compiler @ angular/compiler-cli),当我键入ngc -p scr时,它会创建ngFactory.ts文件并将其编译为dist/tsc-out(默认为angular cli) tsconfig)
I've installed the modules (@angular/compiler @angular/compiler-cli) and when I type ngc -p scr it creates the ngFactory.ts files and compiles it to dist/tsc-out (angular cli default in tsconfig)
不确定如何从这里继续:)
not sure how to proceed from here :)
欢呼
Han
推荐答案
Angular CLI的所有最新beta版本都通过以下方式支持AoT:
All recent beta versions of the Angular CLI support AoT via the following:
ng serve --aot
ng build --aot
#and of course
ng build --prod --aot
注意:从 Angular CLI 1.0.0-beta.28 (2017年2月1日发布),如果指定了--prod
,则默认情况下--aot
处于启用状态.
Note: As of Angular CLI 1.0.0-beta.28 (released February 1st, 2017), --aot
is on by default if --prod
is specified.
这篇关于如何将提前编译器与angular cli webpack一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!