akshita007
akshita007

Reputation: 619

Cannot find module 'rxjs-compat/Subscription'

enter image description hereI am trying to migrate from rx5 to rx6 by following the guide here. Initially, I installed along with the rxjs-compat package and everything works fine. However, when I try to remove the rxjs-compat package, I am getting an exception Cannot find module 'rxjs-compat/Subscription'. I used the rxjs-5-to-6-migrate to perform the migration

I am using this statement for Subscription : import { Subscription } from "rxjs";

For reference this is my branch- https://github.com/akshita31/omnisharp-vscode/tree/rxjs_update and this is the corresponding pull request that lists all the changes - https://github.com/OmniSharp/omnisharp-vscode/pull/2830

Upvotes: 2

Views: 5240

Answers (2)

akshita007
akshita007

Reputation: 619

I updated all the dependencies to the latest versions and used the rxjs-tslint-rules as follows

  1. npm install rxjs-tslint-rules --save-dev
  2. Then in my tslint.json add the rule "rxjs-no-compat" : true
  3. Execute ./node_modules/.bin/tslint -c tslint.json -p tsconfig.json in the project folder. This will give all the set of invalid imports
  4. Resolve the invalid imports and then try removing the rxjs-compat package.
  5. I also cleaned my npm cache - npm cache clean --force
  6. If there are no more errors, we can as well remove the above tslint dependency from the package.json More details can be found in the issue.

Thanks @cartant for the help

Upvotes: 1

Gabriel George
Gabriel George

Reputation: 124

Do you by any chance still have some imports that are still using rxjs-compat?

With the migration from rxjs 5 to 6, you need to be very careful about all the imports, since you don't want to import some module from wrong the wrong path. I believe rxjs-tslint can help you.

Upvotes: 0

Related Questions