Skip to content

AOT error when referencing components from another project #6059

@mbail

Description

@mbail

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

$ ng --version

@angular/cli: 1.0.0
node: 7.8.0
os: linux x64
@angular/common: 4.0.3
@angular/compiler: 4.0.3
@angular/core: 4.0.3
@angular/forms: 4.0.3
@angular/http: 4.0.3
@angular/platform-browser: 4.0.3
@angular/platform-browser-dynamic: 4.0.3
@angular/router: 4.0.3
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.3

Repro steps.

Clone the git project : https://github.com/mbail/aot-error.git
npm install
npm run build (or ng build --aot)

This is a bug when building with AOT (it builds fine with JIT).

I have two projects. The project A has a (git) dependency on project B. The project B contains a ParentComponent whose template refers to a child component selector (). The project A contains the ChildComponent (with selector ), and a module declaring the two components (ParentComponent and ChildComponent).

The log given by the failure.

ERROR in /home/muriel/Workspace/aot-error/src/$$_gendir/node_modules/aot-error-dep/src/app/parent.component.ngfactory.ts (1,1): Cannot find module '../../../../../$_gendir/app/child.component.ngfactory'.

ERROR in ./src/$$_gendir//aot-error-dep/src/app/parent.component.ngfactory.ts
Module not found: Error: Can't resolve '../../../../../$_gendir/app/child.component.ngfactory' in '/home/muriel/Workspace/aot-error/src/$$_gendir/node_modules/aot-error-dep/src/app'
@ ./src/$$_gendir/
/aot-error-dep/src/app/parent.component.ngfactory.ts 8:0-81
@ ./src/$$_gendir/app/app.module.ngfactory.ts
@ ./src/main.ts
@ multi ./src/main.ts

Desired functionality.

No error when building AOT, just like the JIT.
I need to have components in an external git project used to be shared with multiple other projects. So I need to be able to have a parent component in another project that the project containing the child component.

Mention any other details that might be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions