Sanity 3.4.0 RxJS import error: "No matching export for import 'tap'
This is a known dependency conflict issue that occurred with Sanity 3.4.0 related to how RxJS operators are imported in the @sanity/portable-text-editor package. The error happens because the package is trying to import tap, switchMap, and concatMap from the main rxjs module, but your build tool can't find these exports in the ESM5 build.
First, try the standard dependency resolution fix:
Delete your lock file and node_modules, then reinstall:
rm -rf node_modules package-lock.json # or yarn.lock if using yarn
npm installIf that doesn't work:
Based on community discussion, you can temporarily fix this by manually editing node_modules/@sanity/portable-text-editor/lib/index.esm.js and changing the import from:
import { defer, tap, switchMap, of, EMPTY, concatMap, Subject } from 'rxjs';to:
import { defer, of, EMPTY, Subject } from 'rxjs';
import { tap, switchMap, concatMap } from 'rxjs/operators';However, this is just a temporary workaround since it'll be overwritten on the next install.
The recommended long-term solution:
The v2 to v3 upgrade path had several dependency issues like this. If you continue having problems, the community consensus is to start fresh with a new Sanity v3 project and migrate your:
- Schema definitions
- Configuration files
- Custom components and plugins
This avoids the dependency conflicts that can occur with upgraded projects.
Bonus tip: While you're working on your schemas, consider adopting the new defineField and defineType helper functions - they provide better TypeScript support and validation errors:
import {defineField, defineType} from "sanity"The root cause is how the portable text editor's dependencies were bundled in that version, and a clean dependency tree (either through fresh install or new project) typically resolves it.
Show original thread16 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.