Skip to content

Angular-CLI issues an error, when loadChildren-String is not found as a module #5825

Closed
@christian-laakmann

Description

@christian-laakmann

Bug Report or Feature Request (mark with an x)

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

Versions.

angular-cli: 1.0.0-beta.24
node: 6.5.0
os: win32 x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2
@ngtools/webpack: 1.2.1

Repro steps.

Implement and globally provide a custom NgModuleFactoryLoader to handle special requirements in lazy loading.
Add a route:
{ path: '/apps', component: SimpleOutletComponent, loadChildren: 'test-string' }

When running ng build, the bundles are created succesfully & the loader is working, but the build fails with this message:

ERROR in Could not resolve "test-string" from "D:/angular-app/src/app/app.module.ts".

It seems, as if angular-cli tries to pick up the string as a file / module and fails.

The log given by the failure.

Hash: 6ae23753d9793c8fcbca
Time: 78650ms
chunk    {0} main.db2d049f46288ce3dab6.bundle.js, main.db2d049f46288ce3dab6.bundle.map (main) 638 kB {3} [initial] [rendered]
chunk    {1} styles.7f9795ccb231e0c5abe5.bundle.css, styles.7f9795ccb231e0c5abe5.bundle.map, styles.7f9795ccb231e0c5abe5.bundle.map (styles) 451 kB {4} [initial] [rendered]
chunk    {2} scripts.b8479191c8a454be45e6.bundle.js, scripts.b8479191c8a454be45e6.bundle.map (scripts) 918 kB {4} [initial] [rendered]
chunk    {3} vendor.ae57729e6e50ec23b7c5.bundle.js, vendor.ae57729e6e50ec23b7c5.bundle.map (vendor) 7.02 MB [initial] [rendered]
chunk    {4} inline.95175bc457631daf9509.bundle.js, inline.95175bc457631daf9509.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Could not resolve "some string here" from "D:/Workspaces/angular-app/src/app/app.module.ts".

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:ng-build-prod"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build:ng-build-prod: `ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:ng-build-prod script 'ng build --prod'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ipim-portal-client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng build --prod
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ipim-portal-client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ipim-portal-client
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Workspaces\iPIM-Web\iPIM-Web\ipim-portal-client\npm-debug.log

Desired functionality.

The build should not fail, just issue a warning.

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