npm / immer
immer
What changed in immer 8 to 11, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-29.
12 breaking1 security5 new APIs and options3 performance1 behavior and defaults1 tooling27 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initimmer 1135 changes
Breaking changes 2
Reads of a revoked Map or Set draft now throw.
Loose iteration is enabled by default.
Security 1
Prevents prototype pollution via constructor.prototype access.
New APIs and options 4
The WritableNonArrayDraft type is now exported for use by developers.
Adds a helper to check whether a draft was modified.
Adds an optional plugin that overrides specified draft array methods to operate directly on the underlying array, significantly speeding up array operations.
With the plugin enabled, array items passed to callbacks are not automatically wrapped in Proxies, so mutating them can change the underlying objects.
Performance 1
Finalization now uses targeted callbacks instead of recursive tree traversal, improving performance.
Fixes and other changes 27
The Immer constructor now honors class-only shallow copy.
Patches are skipped for a draft discarded by writing its base value back.
Snapshots array length before optimized filter callbacks.
Avoids excessive Draft recursion for readonly arrays in recursive types.
Fixes drafting of relocated base objects at indices that were previously assigned in array methods.
The splice start index is resolved against the pre-splice length in the array-methods plugin.
Nested patches are skipped for children of shifted or reordered arrays.
Set snapshots are rebuilt without mutating the traversal.
Preserves live Map iteration during draft mutations.
Array searches now snapshot the iteration range.
A deletion is no longer recorded when a base value is written back.
The array-methods plugin now forwards thisArg, so callbacks receive the intended this value.
Removed the global var declaration for Iterator that conflicted with the ESNext lib.
Preserves structural sharing for no-op array-method calls.
Inserted array indices are keyed by name in the array-methods plugin.
Corrected the return type of curried produceWithPatches.
Throws the proper Immer error when an applyPatches path traverses null.
Fixes relocated base references for drafts after reverse or sort in the array-methods plugin.
Reverts the prevention of prototype pollution via constructor.prototype access.
Improves DraftMap.entries() compatibility.
Improves DraftMap.values() compatibility.
Assigning undefined to a prototype-inherited key no longer gets dropped.
The typings now assert that the draft value is unwrapped.
Higher-order type inference for WritableDraft is improved.
Removes an invalid curried producer type.
Handles nested proxies after spreading and inserting into an array.
Fixes recursive T for WritableDraft.
immer 1012 changes
Breaking changes 8
enableAllPlugins has been removed; enable patches and Map/Set support separately.
enableES5 has been removed, and projects relying on ES5 mode should not upgrade.
Getters and setters on plain objects are ignored by default; call useStrictShallowCopy(true) at startup when using them.
Shortening a JSON array now produces delete patches instead of a mutation of the length property, in accordance with the JSON spec.
Immer 10 supports only modern browsers with Proxy, Reflect, Symbol, Map, and Set support.
produce is no longer available as the default export; import it as a named export.
Promise-based reducers are no longer supported; use createDraft and finishDraft to work with drafts across asynchronous operations.
The UMD build is no longer exposed; use the ESM package or CJS instead.
New APIs and options 1
Introduces setUseStrictIteration.
Performance 2
Immer performance is optimized where possible.
The non-gzipped bundle size decreased from 16 to 11.5 KB, while the minimal gzipped import of just produce remained roughly 3.3 KB.
Behavior and default changes 1
Immer is now an ESM package that can be imported directly into the browser; CJS should still work.
immer 92 changes
Breaking changes 1
Recipes can no longer return nothing when the target state does not accept undefined, or return arbitrary values; returned values must be assignable to the original state type.
Tooling 1
TypeScript types were improved.
immer 81 changes
Breaking changes 1
Auto-freezing is now enabled by default, including in production. Call setAutoFreeze(process.env.NODE_ENV !== 'production') to restore the old behavior.