Skip to content

@ngtools/webpack v1.2.9 doesn't produce factories for lazy routes #4637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Reuvenc opened this issue Feb 12, 2017 · 8 comments
Closed

@ngtools/webpack v1.2.9 doesn't produce factories for lazy routes #4637

Reuvenc opened this issue Feb 12, 2017 · 8 comments
Labels
needs: investigation Requires some digging to determine if action is needed needs: more info Reporter must clarify the issue

Comments

@Reuvenc
Copy link

Reuvenc commented Feb 12, 2017

Hi,

Updating to version 1.2.9 from 1.2.8 broke lazy loaded components using routes.
In the previous version, webpack produced separate chunk for each lazy route as expected.
In the current version, same process didn't produce the chunks.

OS?

Mac OSX (Sierra)

Versions.

@ngtools/webpack v1.2.9

The log given by the failure.

error_handler.js:55EXCEPTION: Uncaught (in promise): Error: Cannot find module '../../components/+home/home.module.desktop.ngfactory'.
Error: Cannot find module '../../home/home.module.desktop.ngfactory'.
    at webpackEmptyContext (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:40935:8) [angular]
    at SystemJsNgModuleLoader.loadFactory (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:44662:40) [angular]
    at SystemJsNgModuleLoader.load (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:44634:35) [angular]
    at RouterConfigLoader.loadModuleFactory (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:18286:128) [angular]
    at RouterConfigLoader.load (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:18273:81) [angular]
    at MergeMapSubscriber.project (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:65418:111) [angular]
    at MergeMapSubscriber._tryNext (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:19101:27) [angular]
    at MergeMapSubscriber._next (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:19091:18) [angular]
    at MergeMapSubscriber.Subscriber.next (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:685:18) [angular]
    at ScalarObservable._subscribe (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:38681:24) [angular]
    at ScalarObservable.Observable.subscribe (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:118:27) [angular]
    at MergeMapOperator.call (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:19066:23) [angular]
    at Observable.subscribe (http:/localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:115:22) [angular]
    at MergeMapOperator.call (http://localhost:9001/app/main.js?9bcb4af7f8d2ef215eba:19066:23) [angular]

Mention any other details that might be useful.

// package.json
"dependencies": {
    "@angular/common": "2.4.5",
    "@angular/compiler": "2.4.5",
    "@angular/compiler-cli": "2.4.5",
    "@angular/core": "2.4.5",
    "@angular/forms": "2.4.5",
    "@angular/http": "2.4.5",
    "@angular/platform-browser": "2.4.5",
    "@angular/platform-browser-dynamic": "2.4.5",
    "@angular/platform-server": "2.4.5",
    "@angular/router": "3.4.5"
    ...
}

@alonp99
Copy link

alonp99 commented Feb 12, 2017

+1

@hansl
Copy link
Contributor

hansl commented Feb 12, 2017

Could you provide us with an example repo we can use to investigate?

@hansl hansl added needs: investigation Requires some digging to determine if action is needed needs: more info Reporter must clarify the issue labels Feb 12, 2017
@GiuseppePiscopo
Copy link

GiuseppePiscopo commented May 10, 2017

If it can be helpful in solving this (to my team it would be for sure) we have a mini sample project with angular 4.1.1, @ngtools/webpack 1.3.1, webpack 2.2.1, typescript 2.3.2. It currently builds fine but shows the dreaded Error: Cannot find module '../private/module.ngfactory'. when trying to browse to lazy loaded area (dubbed private in the sample).

That is not using full angular-cli, only @ngtools/webpack. The readme shows how to launch the usual npm commands. HTH

EDIT: At branch jit-entry-point there's also a version where the JiT entry point is used, instead of the AoT one coming from past ngc experience.

@serhiisol
Copy link
Contributor

Having same problem, but got this with --prod flag or/with --aot flag

@filipesilva
Copy link
Contributor

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@GiuseppePiscopo
Copy link

GiuseppePiscopo commented May 23, 2017

@filipesilva Just to get a better understanding: we have this same issue without using Angular CLI, just with ngtools/webpack 1.3.1. I got that angular team solved the issue with a new Angular CLI version, but keeping the same ngtools/webpack. Does that mean the issue resides outside of ngtools/webpack ?

@filipesilva
Copy link
Contributor

@GiuseppePiscopo I really can't tell at this point, it's better to open a new issue with updated versions so we can investigate.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

6 participants