如何在 angular cli webpack 中使用提前编译器 [英] how to use ahead-of-time compiler with angular cli webpack

查看:31
本文介绍了如何在 angular cli webpack 中使用提前编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 angular cli 中使用 AOT?

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 :)

干杯

推荐答案

Angular CLI 的所有最新测试版都通过以下方式支持 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屋!

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