Skip to content

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

Closed

Description

@Reuvenc

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"
    ...
}

Activity

  1. alonp99 commented on Feb 12, 2017

    @alonp99

    +1

  2. hansl commented on Feb 12, 2017

    @hansl
    Contributor

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

  3. GiuseppePiscopo commented on May 10, 2017

    @GiuseppePiscopo

    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.

  4. serhiisol commented on May 13, 2017

    @serhiisol
    Contributor

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

  5. filipesilva commented on May 23, 2017

    @filipesilva
    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.

  6. GiuseppePiscopo commented on May 23, 2017

    @GiuseppePiscopo

    @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 ?

  7. filipesilva commented on May 23, 2017

    @filipesilva
    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.

  8. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: investigationRequires some digging to determine if action is neededneeds: more infoReporter must clarify the issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions