Skip to content

Commit

Permalink
fix(aot): remove the genDir plugin option.
Browse files Browse the repository at this point in the history
We still consider the genDir property in the ngOptions of the tsconfig, to stay compatible with code that works with ngc.

Fixes angular#2849.
  • Loading branch information
hansl committed Oct 25, 2016
1 parent 2b17b46 commit 797b336
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface AotPluginOptions {
tsConfigPath: string;
basePath?: string;
entryModule?: string;
genDir?: string;
mainPath?: string;
typeChecking?: boolean;
}
Expand Down Expand Up @@ -57,26 +56,27 @@ export class AotPlugin {
private _compilation: any = null;

private _typeCheck: boolean = true;
private _basePath: string;


constructor(options: AotPluginOptions) {
this._setupOptions(options);
}

get basePath() { return this._angularCompilerOptions.basePath; }
get basePath() { return this._basePath; }
get compilation() { return this._compilation; }
get compilerOptions() { return this._compilerOptions; }
get done() { return this._donePromise; }
get entryModule() { return this._entryModule; }
get genDir() { return this._angularCompilerOptions.genDir; }
get genDir() { return this._basePath; }
get program() { return this._program; }
get typeCheck() { return this._typeCheck; }

private _setupOptions(options: AotPluginOptions) {
// Fill in the missing options.
if (!options.hasOwnProperty('tsConfigPath')) {
throw new Error('Must specify "tsConfigPath" in the configuration of @ngtools/webpack.');
}
}

// Check the base path.
let basePath = path.resolve(process.cwd(), path.dirname(options.tsConfigPath));
Expand All @@ -92,9 +92,7 @@ export class AotPlugin {

// Check the genDir.
let genDir = basePath;
if (options.hasOwnProperty('genDir')) {
genDir = options.genDir;
} else if (tsConfig.ngOptions.hasOwnProperty('genDir')) {
if (tsConfig.ngOptions.hasOwnProperty('genDir')) {
genDir = tsConfig.ngOptions.genDir;
}

Expand All @@ -114,6 +112,7 @@ export class AotPlugin {
entryModule: this._entryModule.toString(),
genDir
});
this._basePath = basePath;

if (options.hasOwnProperty('typeChecking')) {
this._typeCheck = options.typeChecking;
Expand Down

0 comments on commit 797b336

Please sign in to comment.