Is it anyhow possible to trigger trigger angular 2 router to preload a lazy loaded module on mouseover and route to it on click to make a large app more responsive?
Asked
Active
Viewed 384 times
1 Answers
2
Yes it's possible.
Based on your configuration, if it's webpack or SystemJS, you can load the module beforehand and then do what ever you want to .
This is the proper answer :
How to manually lazy load a module?
if you're using webpack , you need to install bundle-loader , and then you can easily require files!.
So for SystemJS :
this.loader.load('./src/test.module').then((factory: NgModuleFactory<any>) => {
console.log(factory);
});
And for Webpack
let file = require('./src/test.module');
console.log(file);
.
-
I think your linked answer refers to systemjs. I have an angular-cli bootstrapped project with Webpack. – Manuel Dec 20 '16 at 21:09