patrickjs / angular-idle-preload Goto Github PK
View Code? Open in Web Editor NEW:soon: Angular Idle Preload for preloading async routes via @TipeIO
Home Page: https://tipe.io
License: MIT License
:soon: Angular Idle Preload for preloading async routes via @TipeIO
Home Page: https://tipe.io
License: MIT License
I hosted my angular application on a linux server and got error "Cannot find module 'rxjs/observable'" on the build process.
I ended up editing the @AngularClass index.d.ts from rxjs/observable to rxjs/Observable
Currenlty this library is not compatible with rxjs 6. Since Angular 6 requires rxjs 6 it is also not compatible with Angular 6.
ERROR in ./node_modules/angular-idle-preload/dist/index.js
Module not found: Error: Can't resolve 'rxjs/observable/of' in '/my-project//node_modules/angular-idle-preload/dist'
@ ./node_modules/angular-idle-preload/dist/index.js 9:11-40
@ ./src/environments/environment.ts
@ ./src/app/app.routes.ts
@ ./src/app/app.routes.spec.ts
@ ./src sync \.spec\.ts$
@ ./src/test.ts
Until this is fixed we can use rxjs-compat
as a workaround.
I try to make it work with Angular Universal. The main problem is in node: window is not defined
I have added:
var mockWindow = {
setTimeout: function(fn, time) { return gobal.setTimeout(fn, time); }
}
function _requestIdle(zone) {
var win = typeof window === 'undefined' ? mockWindow : window;
if (win.requestIdleCallback) {
return function (fn) { return win.requestIdleCallback(fn); };
}
return function (fn) { return zone.runOutsideAngular(function () { return win.setTimeout(fn, 10); }); };
}
But then I get the error:
EXCEPTION: Response with status: 200 Ok for URL: null
/Users/fabienrogeret/Projects/Impressview/web/node_modules/zone.js/dist/zone-node.js:158
throw error;
^
Response with status: 200 Ok for URL: null
Any idea?
ERROR in [at-loader] ./node_modules/@angularclass/idle-preload/dist/index.d.ts:1:39
TS2305: Module '"MYPATH/node_modules/@angular/core/index"' has no exported member 'OpaqueToken'.
webpack: Failed to compile.
I got this when using [email protected] with [email protected]
ERROR in node_modules/angular-idle-preload/dist/index.d.ts(2,28): error TS2307: Cannot find module 'rxjs/observable'.
Please advise. What should I do?
I'm using this starter: https://github.com/qdouble/angular-webpack2-starter
I have created few more lazy routes than the starter have and I have replaced:
RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules}),
by
IdlePreloadModule.forRoot(), // forRoot ensures the providers are only created once
RouterModule.forRoot([], { useHash: false, preloadingStrategy: IdlePreload }),
But when starting the application with yarn start:hmr
the main route is loaded but not child route, this is working well with PreloadAllModules
but not with IdlePreload
.
Nothing happens, modules are not loaded
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.