Skip to content

Lazy Routes Fail To Load, but Only with ng serve -prod #1112

Closed
@antonyRoberts

Description

@antonyRoberts

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Windows 10

  1. Versions:

angular-cli: 1.0.0-beta.6
node: 6.1.0
os: win32 x64

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

Fresh install of a new project, when using version 3.0.0-alpha.6 of @angular/router, lazy routes are not able to load when using "ng serve -prod". The normal routes work fine under prod mode, and both lazy routes and normal routes work fine with just "ng serve"

  1. The log given by the failure. Normally this include a stack trace and some
    more information.

EXCEPTION: Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://127.0.0.1:4200/app/lazy/lazy.js at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:769:30) at ZoneDelegate.invokeTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:356:38) at Object.onInvokeTask (http://127.0.0.1:4200/main.js:23:29322) at ZoneDelegate.invokeTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:355:43) at Zone.runTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:256:48) at XMLHttpRequest.ZoneTask.invoke (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:423:34) Error loading http://127.0.0.1:4200/app/lazy/lazy.js zone.js:461 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://127.0.0.1:4200/app/lazy/lazy.js at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:769:30) at ZoneDelegate.invokeTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:356:38) at Object.onInvokeTask (http://127.0.0.1:4200/main.js:23:29322) at ZoneDelegate.invokeTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:355:43) at Zone.runTask (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:256:48) at XMLHttpRequest.ZoneTask.invoke (http://127.0.0.1:4200/vendor/zone.js/dist/zone.js:423:34) Error loading http://127.0.0.1:4200/app/lazy/lazy.js ; Zone: angular ; Task: Promise.then ; Value: Error: Error: XHR error (404 Not Found) loading http://127.0.0.1:4200/app/lazy/lazy.js(…)consoleError @ zone.js:461_loop_1 @ zone.js:490drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426 zone.js:463 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://127.0.0.1:4200/app/lazy/lazy.js(…)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfultype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions