Angular 2 rc 6
written in Typescript 2.0.2
I\'m trying to learn Ahead-of-Time compilation as outlined here. It seems simple enough:
I was trying to get this to work as well and William Gilmour's answer helped a lot.
I extended it a little to run a local ngc
installation (like the angular 2 example that runs the one in node_modules/.bin
), and which works both on Linux and Windows systems:
var exec = require('child_process').exec;
var os = require('os');
gulp.task('build-ts', function (cb) {
var cmd = os.platform() === 'win32' ?
'node_modules\\.bin\\ngc' : './node_modules/.bin/ngc';
exec(cmd, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});