angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

Lazy loading broken (Cannot find module) with 1.5.0 and Angular 5 #8327

Closed Ismaestro closed 6 years ago

Ismaestro commented 6 years ago

Bug Report or Feature Request (mark with an x)

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

Versions.

Angular CLI: 1.5.0 Node: 7.1.0 OS: darwin x64 Angular: 5.0.0 ... animations, common, compiler, compiler-cli, core, forms ... http, platform-browser, platform-browser-dynamic ... platform-server, router

@angular/cdk: 2.0.0-beta.12 @angular/cli: 1.5.0-rc.8 @angular/flex-layout: 2.0.0-beta.10 @angular/material: 2.0.0-beta.12 @angular-devkit/ build-optimizer: 0.0.32 @angular-devkit/ core: 0.0.20 @angular-devkit/ schematics: 0.0.35 @ngtools/ json-schema: 1.1.0 @ngtools/ webpack: 1.8.0-rc.8 @schematics/ angular: 0.0.49 typescript: 2.4.2 webpack: 3.8.1

Repro steps.

Clone this repo: https://github.com/Ismaestro/angular4-example-app.git Checkout the branch called angular5 npm i npm run test

You will see the error.

screen shot 2017-11-03 at 10 26 02

The log given by the failure.

Chrome 61.0.3163 (Mac OS X 10.12.6) AppComponent should change title meta tag in heroes path FAILED
        Error: Cannot find module './heroes/heroes.module'.
            at http://localhost:9876/_karma_webpack_/webpack:/Users/ismael.ramos.silvan/WebstormProjects/angular4-example-app/src/$_lazy_route_resource lazy:5:1

Desired functionality.

Can lazy loading with the new version of angular.

Mention any other details that might be useful.

I have to say, I can start the app and everything works fine. Only the tests with karma fails...

masalbert commented 6 years ago
captura de pantalla 2017-11-04 a les 19 27 39

yes, with ng serve -aot

Project with lazyModule

Angular CLI: 1.5.0
Node: 8.2.1
OS: darwin x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1
Ismaestro commented 6 years ago

But my error is only happening running unit tests... when does this error occurs?

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.