Skip to content

Bundling for lazy loading is broken: No module factory available #3793

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
yfain opened this issue Dec 30, 2016 · 8 comments
Closed

Bundling for lazy loading is broken: No module factory available #3793

yfain opened this issue Dec 30, 2016 · 8 comments

Comments

@yfain
Copy link

yfain commented Dec 30, 2016

After upgrading CLI to beta.24 my app that uses lazy loaded module started giving me errors during ng serve:

NG Live Development Server is running on http://lo 60% building modules 515/611 modules 96 active .../compiler/src/i18n/serializers/xtb.jsError: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:188:20)
at Compilation.processModuleDependencies (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:177:7)
at /Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:317:12
at /Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:124:4
at Array.forEach (native)
at callback (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:123:12)
at /Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:147:10
at ContextModule. (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/ContextModule.js:93:3)
at /Users/yfain11/Documents/angular-cli/packages/@ngtools/webpack/src/utils.ts:11:13
at /Users/yfain11/Documents/angular-cli/packages/@ngtools/webpack/src/plugin.ts:196:124
at ContextModule.resolveDependencies (/Users/yfain11/Documents/angular-cli/packages/@ngtools/webpack/src/utils.ts:5:9)
at ContextModule.build (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/ContextModule.js:74:7)
at Compilation.buildModule (/Users/yfain11/Documents/Farata/_Training/courseware/angular2/handouts/12-hr-intro/unit2/router-samples/node_modules/webpack/lib/Compilation.js:127:9)

===

I downgraded CLI to beta.22-1 in devDependencies in package.json. The error remained the same.
After downgrading to beta.21 the ng serve and the app work fine again.

@filipesilva
Copy link
Contributor

I'm going to have to ask you to fill in the issue template, complete with repro steps. There just isn't much I can figure out just by looking at that log.

@yfain
Copy link
Author

yfain commented Dec 30, 2016

To reproduce, download this project:
https://github.com/Farata/angular2typescript/tree/master/chapter3/cli_version/router-samples

ng serve builds a simple app with the lazy loading of one module (LuxuryModule), and it runs fine. Currently it uses Angular CLI beta.21. Change the version of Angular CLI to beta.24 in package.json and do npm install.

Try ng serve again, and you'll see this error.

@viltsu
Copy link

viltsu commented Jan 6, 2017

I had same issue. To get it working I had to run it with npm start instead of ng serve

@hrvolapeter
Copy link

@viltsu this definitely isn't fix as npm start is just alias for ng serve, nothing more.

@ChrisProlls
Copy link

Same error for me. Any news ?

@yfain
Copy link
Author

yfain commented May 1, 2017

After reporting this issue I split the bootstrap code (main.ts) and the app.module.ts into separate files and this error was gone.

@RubensTen
Copy link

you can try

#4246 (comment)

@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants