Angular2 SystemJs,提前编译与Gulp

时间:2022-03-24 12:51:47

Can anyone please guide how to use Gulp for Ahead of Time compilation of a Angular2 project that uses SystemJs. I mean to automate all steps mentioned in https://angular.io/docs/ts/latest/cookbook/aot-compiler.html

任何人都可以指导如何使用Gulp提前编译使用SystemJs的Angular2项目。我的意思是自动执行https://angular.io/docs/ts/latest/cookbook/aot-compiler.html中提到的所有步骤

i.e. generate NgFactories, Treeshaking and bundling?

即生成NgFactories,Treeshaking和捆绑?

1 个解决方案

#1


1  

You do not need to use gulp for that. You just "hide" the commands behind an npm "package.json" script command. (If you really want to fire cmd with gulp you can use the shell js gulp plugin for example). After you have the output of AoT you need any tool which takes the output and can work with that. You have to create bundles to get the application in production state. Therefore you can use rollup.js or webpack. You do not need to take gulp anymore. However, there are gulp-rollup and gulp-webpack plugins out there. But using webpack or rollup.js after doing AoT without gulp should give you what you want.

你不需要使用gulp。您只需“隐藏”npm“package.json”脚本命令后面的命令。 (如果你真的想用gulp激活cmd,你可以使用shell js gulp插件)。获得AoT的输出后,您需要任何可以获取输出的工具,并且可以使用它。您必须创建捆绑包才能使应用程序处于生产状态。因此,您可以使用rollup.js或webpack。你不需要再喝了一口气。但是,有gulp-rollup和gulp-webpack插件。但是在没有gulp的情况下进行AoT后使用webpack或rollup.js可以给你你想要的。

#1


1  

You do not need to use gulp for that. You just "hide" the commands behind an npm "package.json" script command. (If you really want to fire cmd with gulp you can use the shell js gulp plugin for example). After you have the output of AoT you need any tool which takes the output and can work with that. You have to create bundles to get the application in production state. Therefore you can use rollup.js or webpack. You do not need to take gulp anymore. However, there are gulp-rollup and gulp-webpack plugins out there. But using webpack or rollup.js after doing AoT without gulp should give you what you want.

你不需要使用gulp。您只需“隐藏”npm“package.json”脚本命令后面的命令。 (如果你真的想用gulp激活cmd,你可以使用shell js gulp插件)。获得AoT的输出后,您需要任何可以获取输出的工具,并且可以使用它。您必须创建捆绑包才能使应用程序处于生产状态。因此,您可以使用rollup.js或webpack。你不需要再喝了一口气。但是,有gulp-rollup和gulp-webpack插件。但是在没有gulp的情况下进行AoT后使用webpack或rollup.js可以给你你想要的。