Skip to content

Commit c9ac263

Browse files
tsabirgalievhansl
authored andcommitted
fix(@ngtools/webpack): honor tsconfig#angularCompilerOptions.entryModule before trying to resolveEntryModuleFromMain() (#4013)
1 parent 5a27fdb commit c9ac263

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/@ngtools/webpack/src/plugin.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,16 @@ export class AotPlugin implements Tapable {
167167

168168
if (options.entryModule) {
169169
this._entryModule = options.entryModule;
170-
} else {
171-
if (options.mainPath) {
172-
this._entryModule = resolveEntryModuleFromMain(options.mainPath, this._compilerHost,
173-
this._program);
174-
} else {
175-
this._entryModule = (tsConfig.raw['angularCompilerOptions'] as any).entryModule;
176-
}
170+
} else if ((tsConfig.raw['angularCompilerOptions'] as any)
171+
&& (tsConfig.raw['angularCompilerOptions'] as any).entryModule) {
172+
this._entryModule = path.resolve(this._basePath,
173+
(tsConfig.raw['angularCompilerOptions'] as any).entryModule);
174+
}
175+
176+
// still no _entryModule? => try to resolve from mainPath
177+
if (!this._entryModule && options.mainPath) {
178+
this._entryModule = resolveEntryModuleFromMain(options.mainPath, this._compilerHost,
179+
this._program);
177180
}
178181

179182
if (options.hasOwnProperty('i18nFile')) {

0 commit comments

Comments
 (0)