Search code examples
angularrxjsangular12rxjs7

Module not found: Error: Package path ./index is not exported from package node_modules/rxjs (see exports field in /node_modules/rxjs/package.json)


I am trying RxJs7 in my angular 12.2.0 project and it seems like the path of rxjs operator and method changed.

I am getting the below error

./dist/candypal/website/fesm2015/candypal-website.js:8:0-50 - Error: Module not found: Error: Package path ./index is not exported from package /Users/aniruddh/aniruddh/develop/experiment/candypal/node_modules/rxjs (see exports field in /Users/aniruddh/aniruddh/develop/experiment/candypal/node_modules/rxjs/package.json)

Note that the above error is coming from a library that uses rxjs7


Solution

  • In your code, replace

    import { Whatever } from 'rxjs/index'
    

    by

    import { Whatever } from 'rxjs'
    

    The rxjs/index folder was removed from rxjs.