No module factory available for dependency type: ContextElementDependency
See original GitHub issueDo you want to request a feature or report a bug?
Possibly a bug - seeking advice on how to track down the error. It seems to be an imcompatibility between 3.10.0 and 3.11.0 that I’d like to understand so I can solve similiar problems in the future.
What is the current behavior?
An angular 6.0.0-beta.4 app compiles fine on Webpack 3.10.0 but fails with the error mentioned in the title when upgrading to 3.11.0
It fails for my two lazy-loaded modules although I’m using @ngtools/webpack
, even adding angular-router-loader doesn’t solve the problem (and shouldn’t be required as it works without in 3.10.0)
If the current behavior is a bug, please provide the steps to reproduce.
Can’t offer a repro as the project is closed source.
What is the expected behavior?
The app compiles.
If this is a feature request, what is motivation or use case for changing the behavior?
–
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
node 9.3.0 webpack 3.11.0 webpack-dev-middleware 2.0.5 ngtools/webpack 1.10.0-rc.0 angular 6.0.0-beta.4
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
OK, I understand, there’s no chance (and need) to try to debug other than bugging library authors to regularly update their dependencies. For the time being I’ll solve it by specifing resolutions in my package.json.
Thanks for your support!
IIRC it is not that the the second version is pulled into the firsts compilation, but rather that different webpack plugins are using different versions of stuff like
ContextElementDependency
.In this specific case,
@ngtools/webpack
importsContextElementDependency
https://github.com/angular/angular-cli/blob/9a593dd32cb79ec6f581c7bd2d5ca1d4cbdddcdd/packages/%40ngtools/webpack/src/angular_compiler_plugin.ts#L7
in order to correctly populate the context dependencies for the angular/core
import()
callhttps://github.com/angular/angular-cli/blob/9a593dd32cb79ec6f581c7bd2d5ca1d4cbdddcdd/packages/%40ngtools/webpack/src/angular_compiler_plugin.ts#L587-L596
Depending on your node_modules structure, the plugin might be using
ContextElementDependency
from a different Webpack than the one that is running.