From b8736778a9d34b83ac93cc75b3f29d67b9ec0170 Mon Sep 17 00:00:00 2001 From: Tair Sabirgaliev Date: Sun, 15 Jan 2017 00:50:18 +0600 Subject: [PATCH 1/2] `@ngtools/webpack`: honor `tsconfig#angularCompilerOptions.entryModule` before falling back to `resolveEntryModuleFromMain()` --- packages/@ngtools/webpack/src/plugin.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/@ngtools/webpack/src/plugin.ts b/packages/@ngtools/webpack/src/plugin.ts index 939efd0e4017..ec5ac270435f 100644 --- a/packages/@ngtools/webpack/src/plugin.ts +++ b/packages/@ngtools/webpack/src/plugin.ts @@ -167,13 +167,14 @@ export class AotPlugin implements Tapable { if (options.entryModule) { this._entryModule = options.entryModule; - } else { - if (options.mainPath) { - this._entryModule = resolveEntryModuleFromMain(options.mainPath, this._compilerHost, - this._program); - } else { - this._entryModule = (tsConfig.raw['angularCompilerOptions'] as any).entryModule; - } + } else if (this._angularCompilerOptions.entryModule) { + this._entryModule = path.resolve(this._basePath, this._angularCompilerOptions.entryModule); + } + + // still no _entryModule? => try to resolve from mainPath + if (!this._entryModule && options.mainPath) { + this._entryModule = resolveEntryModuleFromMain(options.mainPath, this._compilerHost, + this._program); } if (options.hasOwnProperty('i18nFile')) { From f4b8f51a58a065a6fdaaae13e96c9eba1be11169 Mon Sep 17 00:00:00 2001 From: Tair Sabirgaliev Date: Sun, 15 Jan 2017 01:57:52 +0600 Subject: [PATCH 2/2] make type checker and linter happy --- packages/@ngtools/webpack/src/plugin.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/@ngtools/webpack/src/plugin.ts b/packages/@ngtools/webpack/src/plugin.ts index ec5ac270435f..3c43a823b574 100644 --- a/packages/@ngtools/webpack/src/plugin.ts +++ b/packages/@ngtools/webpack/src/plugin.ts @@ -167,10 +167,12 @@ export class AotPlugin implements Tapable { if (options.entryModule) { this._entryModule = options.entryModule; - } else if (this._angularCompilerOptions.entryModule) { - this._entryModule = path.resolve(this._basePath, this._angularCompilerOptions.entryModule); + } else if ((tsConfig.raw['angularCompilerOptions'] as any) + && (tsConfig.raw['angularCompilerOptions'] as any).entryModule) { + this._entryModule = path.resolve(this._basePath, + (tsConfig.raw['angularCompilerOptions'] as any).entryModule); } - + // still no _entryModule? => try to resolve from mainPath if (!this._entryModule && options.mainPath) { this._entryModule = resolveEntryModuleFromMain(options.mainPath, this._compilerHost,