Skip to content

loadChildren on modules that are outside src fails #6755

@cedvdb

Description

@cedvdb

Bug Report or Feature Request (mark with an x)

- [ X ] bug report 

Explanation

I've seen multiple people on gitter and on stackoverflow being confused by this, including me. When the router uses lazy loading with a module that is outside the src folder (in node_modules for instance) the build will fail giving the error: ERROR in ./src/$$_gendir async

Related to this and this

If you can provide a simple repro we can investigate.

Repro steps.

git clone https://github.com/cedvdb/test-aot-bug.git && cd test-aot-bug && npm install && ng serve --aot

The error will appear in the console at the end. I cannot make a plnkr for this.

The log given by the failure.

ERROR in ./src/$$_gendir async
Module not found: Error: Can't resolve '/home/ced/Documents/angular/aot-bug/s
rc/node_modules/test-aot-bug/test.module.ngfactory.ts' in '/home/ced/Documents/angular/aot-bug/src/$$_gendir'
 @ ./src/$$_gendir async
 @ ./~/@angular/core/@angular/core.es5.js
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

notice it tries to find node_modules in the src folder.

Desired functionality.

It would be nice if loadChildren worked with ngModules that are outside the src folder. Mainly the node_modules folder

Versions.

@angular/cli: 1.1.2
node: 8.0.0
os: linux x64

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