immer
11.2.9 · 22 Oct 2026MIT89.4M / weekRepositoryHomepagenpmAtom feed
10.2.0 is the newest release of 10.x.
In short
8 breaking6 changed
- breaking
Immer 10 only supports modern browsers, that have support for
Proxy,Reflect,SymbolandMapandSet. - breaking
There is no longer a UMD build exposed (thanks Mark Erikson for modernizing the build setup in #1032!
- breaking
Getters and setters are ignored by default on plain object, as this is a very uncommon case and provides a significant performance boost (ca 33%, but depends a lot on the scenario). Fixes #867, #1012. Thanks hrsh7th for implementing it in #941!
- breaking
Promise based reducers are no longer supported. Conceptually it is an anti pattern to hold on to drafts over time. If needed the old behavior can still be achieved by leveraging
createDraftandfinishDraft. - breaking
ES5 mode (for legacy browsers) has been dropped. If your project relies on
enableES5(), you SHOULD NOT upgrade Immer.enableES5has been removed. - breaking
produceis no longer exposed as thedefaultexport. This improves eco system compatibility, and makes sure that there is only one correct way of doing things - breaking
enableAllPluginshas been removed, useenablePatches(); enableMapSet()instead - breaking
Shortening the length of a JSON array now results in delete patches, rather than a mutation of the
lengthproperty, in accordance with JSON spec. Thanks kshramt for implementing this in #964!
Release note
Release notes
- breaking
Immer 10 only supports modern browsers, that have support for
Proxy,Reflect,SymbolandMapandSet. - breaking
There is no longer a UMD build exposed (thanks Mark Erikson for modernizing the build setup in #1032!
- breaking
Getters and setters are ignored by default on plain object, as this is a very uncommon case and provides a significant performance boost (ca 33%, but depends a lot on the scenario). Fixes #867, #1012. Thanks hrsh7th for implementing it in #941!
- breaking
Promise based reducers are no longer supported. Conceptually it is an anti pattern to hold on to drafts over time. If needed the old behavior can still be achieved by leveraging
createDraftandfinishDraft. - breaking
ES5 mode (for legacy browsers) has been dropped. If your project relies on
enableES5(), you SHOULD NOT upgrade Immer.enableES5has been removed. - breaking
produceis no longer exposed as thedefaultexport. This improves eco system compatibility, and makes sure that there is only one correct way of doing things - breaking
enableAllPluginshas been removed, useenablePatches(); enableMapSet()instead - breaking
Shortening the length of a JSON array now results in delete patches, rather than a mutation of the
lengthproperty, in accordance with JSON spec. Thanks kshramt for implementing this in #964! Immer is now an ESM package that can be directly imported into the browser. CJS should still work, UMD support has been removed.
Overall, there is a rough performance increase of 33% for Immer (and in some cases significantly higher), and the (non gzipped) bundle size has reduced from 16 to 11.5 KB, while the the minimal gzipped import of just produce has remained roughly the same at 3.3 KB.
For more details, see #1015
Migration steps
If you have any
enableES5()call, don't migrateWhen using getters/ setters icmw plain objects, call
useStrictShallowCopy(true)at startupReplace all default imports: Replace
import produce from "immer"withimport {produce} from "immer"Replace all calls to
enableAllPlugins()withenablePatches(); enableMapSet();to be more specific and smoothen future migrations.If any producer returned a Promise, refactor it to leverage
createDraftinstead. Roughly:
const newState = await produce(oldState, recipe) // becomes const draft = createDraft(oldState) await recipe(draft) const newState = finishDraft(draft)