Skip to content

Generated ngfactory files can sometimes use an incorrect import path #12249

@jelbourn

Description

@jelbourn

What's happening

Attempting to AoT compile an application that consumes the @angular/material components. The ngfactory files are generated from the .ts sources for the app and from the .d.ts and .metadata.json files in the material package.

The problem is that the ngfactories generated from the .ts sources are attempting to import the ngfactories for the material components from where the .d.ts files live and not from where the tool itself outputted the ngfactories for the material components (inside the specified genDir).

Steps to reproduce:

Errors you should see:

src/e2e-app/aot/button/button-e2e.ngfactory.ts(20,27): error TS2307: Cannot find module '../../../../dist/@angular/material/button/button.ngfactory'.
src/e2e-app/aot/button/button-e2e.ngfactory.ts(22,27): error TS2307: Cannot find module '../../../../dist/@angular/material/icon/icon.ngfactory'.
src/e2e-app/aot/dist/@angular/material/button-toggle/button-toggle.ngfactory.ts(8,26): error TS2307: Cannot find module './button-toggle'.
src/e2e-app/aot/dist/@angular/material/button-toggle/button-toggle.ngfactory.ts(20,27): error TS2307: Cannot find module '../core/coordination/unique-selection-dispatcher'.
src/e2e-app/aot/dist/@angular/material/button/button.ngfactory.ts(8,26): error TS2307: Cannot find module './button'.
...

Node version is 6.3.1, compiler-cli version is 0.6.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions