Code Guru
Code Guru

Reputation: 15598

Can't resolve 'rxjs-compat/observable/combineLatest'

I have upgraded my angular project to

"rxjs": "^6.3.3"

I have used combineLatest operator, but after upgrading, I am facing issues and compilation is failed

ERROR in ./node_modules/rxjs/observable/combineLatest.js
Module not found: Error: Can't resolve 'rxjs-compat/observable/combineLatest' in 'D:\MyProject\node_modules\rxjs\observable'

I am importing like

import { map, distinctUntilChanged, filter, combineLatest } from "rxjs/operators";

even I have updated the syntax

_col$.pipe(combineLatest(this.meta$.asObservable()))

Do I need to install rxjs-compat?

But I read this

rxjs-compat provides a temporary compatibility layer between the APIs of v5 and v6. Essentially, rxjs-compat provisions your codebase with functionality from v5 that it relies on, allowing you to gradually upgrade your codebase to v6. To complete the upgrade process and remove the rxjs-compat dependency from your project,

Am I missing something?

Upvotes: 2

Views: 1175

Answers (2)

anosha_rehan
anosha_rehan

Reputation: 1600

In the latest updates you can import combineLatest like this:

import { combineLatest } from 'rxjs';

Upvotes: 1

martin
martin

Reputation: 96969

You are probably somewhere in your app using the old style of "patch" operators. For example like this:

import 'rxjs/add/operator/combineLatest'

If you want to keep using this style then you need to install also rxjs-compat package.

Anyway consider migrating to pipable operators:

Upvotes: 4

Related Questions