Skip to content
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

Not running with RxJS 6+ #20

Open
JLNNN opened this issue May 24, 2018 · 3 comments
Open

Not running with RxJS 6+ #20

JLNNN opened this issue May 24, 2018 · 3 comments

Comments

@JLNNN
Copy link

JLNNN commented May 24, 2018

Hey,
thanks for your great module! :)

With the latest update of RxJS this seems broken:

ERROR in ./node_modules/ui-carousel/dist/src/ui-carousel/ui-carousel.component.js
Module not found: Error: Can't resolve 'rxjs/Subject' in '/node_modules/ui-carousel/dist/src/ui-carousel'
 @ ./node_modules/ui-carousel/dist/src/ui-carousel/ui-carousel.component.js 4:16-39
 @ ./node_modules/ui-carousel/dist/index.js
 @ ./src/app/common/common.module.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

ERROR in ./node_modules/ui-carousel/dist/src/ui-carousel/ui-carousel.component.js
Module not found: Error: Can't resolve 'rxjs/add/operator/throttleTime' in '/node_modules/ui-carousel/dist/src/ui-carousel'
 @ ./node_modules/ui-carousel/dist/src/ui-carousel/ui-carousel.component.js 5:0-41
 @ ./node_modules/ui-carousel/dist/index.js
 @ ./src/app/common/common.module.ts
 @ ./src/app/app.module.ts
 @ ./src/app/index.ts
 @ ./src/main.browser.ts
 @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

Have a nice day & greetings from Germany!
-- Julian

@JLNNN
Copy link
Author

JLNNN commented May 24, 2018

Update: It's working when installing npm i rxjs-compat and using these packages manually. Can you fix this so we don't have to edit our node_module files?

Example /node_modules/ui-carousel/dist/src/ui-carousel/ui-carousel.component.js lines 4 and 5:

var Subject_1 = require("rxjs-compat/Subject");
require("rxjs-compat/add/operator/throttleTime");

@joscmw95
Copy link

This repo is not maintained for a rather long time now, it'd be best to just include the source as a component in your app, then you can choose not to use rxjs-compat since it adds quite a significant amount to your app size.

@Aitthi
Copy link

Aitthi commented Jan 16, 2019

Change code in ui-carousel.component.ts

...
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { Subscription } from 'rxjs/Subscription';
import 'rxjs/add/operator/throttleTime';
...

this.subscriptions.add(this.nextSubject.throttleTime(this.speed).subscribe(() => {
    if (!this.fade) {
        this.slideLeft();
    } else {
        this.fadeLeft();
    }
}));
this.subscriptions.add(this.prevSubject.throttleTime(this.speed).subscribe(() => {
    if (!this.fade) {
        this.slideRight();
    } else {
        this.fadeRight();
    }
}));

...
############
to =>
############
...

import {Observable, Subject, Subscription} from 'rxjs';
import { throttleTime } from 'rxjs/operators';

...

this.subscriptions.add(this.nextSubject.pipe(throttleTime(this.speed)).subscribe(() => {
    if (!this.fade) {
        this.slideLeft();
    } else {
        this.fadeLeft();
    }
}));
this.subscriptions.add(this.prevSubject.pipe(throttleTime(this.speed)).subscribe(() => {
    if (!this.fade) {
        this.slideRight();
    } else {
        this.fadeRight();
    }
}));

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants