Migrating to Apollo Client @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3
Version @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3 introduces 6 breaking changes. This guide details how to update your code.
Released: 8/20/2025
⚠️ Check Your Code
If you use any of these symbols, you need to read this guide:
HttpLinkLocalStateclientAwarenessdevtools.enabledprioritizeCacheValues@apollo/client/main.cjs@apollo/client/react/react.cjs@apollo/client@apollo/client/reactBreaking Changes
●Issue #1
Options `uri`, `headers` and `credentials` are no longer top-level; they must be moved into a `link` option with a new `HttpLink` instance.
●Issue #2
`name` and `version` options have been moved into a `clientAwareness` option.
●Issue #3
`typeDefs` and `fragmentMatcher` options have been removed; use `localState` with a `LocalState` instance and move `resolvers` accordingly.
●Issue #4
`connectToDevTools` option has been renamed to `devtools.enabled`.
●Issue #5
`disableNetworkFetches` option has been renamed to `prioritizeCacheValues`.
●Issue #6
Imports from legacy entry points such as `@apollo/client/main.cjs` or `@apollo/client/react/react.cjs` must be updated to the new entry points `@apollo/client` or `@apollo/client/react`.
Migration Steps
- 1Run the new `clientSetup` codemod (e.g., `npx apollo clientSetup`) to automatically apply the configuration changes.
- 2If not using the codemod, manually move `uri`, `headers`, and `credentials` into a `link` option with a new `HttpLink` instance.
- 3Move `name` and `version` into a `clientAwareness` option.
- 4Replace removed `typeDefs` and `fragmentMatcher` options with a `localState` option containing a `LocalState` instance and relocate `resolvers`.
- 5Rename `connectToDevTools` to `devtools.enabled` and `disableNetworkFetches` to `prioritizeCacheValues`.
- 6If `dataMasking` is enabled, add the provided global type augmentation template.
- 7If using custom links, add the `incrementalHandler` option and the corresponding type augmentation template.
- 8Run the `legacyEntryPoints` transformation (or update import statements) to replace legacy entry point paths with the new ones.
Release Summary
Apollo Client introduces a `clientSetup` codemod to restructure client configuration and a `legacyEntryPoints` transformation to update import paths, requiring updates to option names, removed settings, and import statements.
Need More Details?
View the full release notes and all changes for Apollo Client @apollo/client-codemod-migrate-3-to-4@1.0.0-rc.3.
View Full Changelog