Skip to content

Components with the same name (via alias) results in ngfactory with duplicate function implementations #19935

Closed
@jelbourn

Description

@jelbourn

Steps to reproduce

After this runs once, you can re-run ngc as:

./node_modules/.bin/ngc -p ./dist/packages/e2e-app/tsconfig-build.json

(gulp e2e will build all of the dependencies as well)

Expected

The e2e app compiles successfully (as with Angular 4)

Actual

ngc emits an error

e2e-app-module.ngfactory.ts(451,10): error TS2393: Duplicate function implementation.
e2e-app-module.ngfactory.ts(454,10): error TS2393: Duplicate function implementation.
e2e-app-module.ngfactory.ts(458,10): error TS2393: Duplicate function implementation.
e2e-app-module.ngfactory.ts(461,10): error TS2393: Duplicate function implementation.

The file e2e-app-module.ngfactory.ts is not written to the file system.

Commentary

E2eAppModule declares (and marks as entryComponents) two classes both called TestDialog. In the module file, they are imported like:

import {TestDialog} from './dialog/dialog-e2e';
import {TestDialog as TestDialogFullScreen} from './fullscreen/fullscreen-e2e';

Renaming one of them resolves the error.

cc @tbosch @chuckjaz @crisbeto

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimehotlist: components teamRelated to Angular CDK or Angular MaterialregressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions