refactor(compiler-cli): use the transformer based compiler by default
The source map does not currently work with the transformer pipeline. It will be re-enabled after TypeScript 2.4 is made the min version. To revert to the former compiler, use the `disableTransformerPipeline` in tsconfig.json: ``` { "angularCompilerOptions": { "disableTransformerPipeline": true } } ```
This commit is contained in:
@ -7,14 +7,19 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
|
||||
// Must be imported first, because Angular decorators throw on load.
|
||||
import 'reflect-metadata';
|
||||
|
||||
import * as ts from 'typescript';
|
||||
import * as tsc from '@angular/tsc-wrapped';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as ngc from './ngc';
|
||||
|
||||
import {isSyntaxError} from '@angular/compiler';
|
||||
|
||||
import {readConfiguration} from './perform-compile';
|
||||
|
||||
import {CodeGenerator} from './codegen';
|
||||
|
||||
function codegen(
|
||||
@ -46,6 +51,19 @@ export function main(
|
||||
|
||||
// CLI entry point
|
||||
if (require.main === module) {
|
||||
const args = require('minimist')(process.argv.slice(2));
|
||||
main(args).then((exitCode: number) => process.exit(exitCode));
|
||||
const args = process.argv.slice(2);
|
||||
const parsedArgs = require('minimist')(args);
|
||||
const project = parsedArgs.p || parsedArgs.project || '.';
|
||||
|
||||
const projectDir = fs.lstatSync(project).isFile() ? path.dirname(project) : project;
|
||||
|
||||
// file names in tsconfig are resolved relative to this absolute path
|
||||
const basePath = path.resolve(process.cwd(), projectDir);
|
||||
const {ngOptions} = readConfiguration(project, basePath);
|
||||
|
||||
if (ngOptions.disableTransformerPipeline) {
|
||||
main(parsedArgs).then((exitCode: number) => process.exit(exitCode));
|
||||
} else {
|
||||
process.exit(ngc.main(args, s => console.error(s)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user