Giter Club home page Giter Club logo

angular-idle-preload's Issues

Cannot find module 'rxjs/observable'

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

Angular 6 / rxjs 6 compatability

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.

Not compatible with Angular Universal

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?

Update for angular 5

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.

Not working?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.