v1.3.0-alpha.9
Pre-releaseThis release reduces bundle sizes by forking and inlining the redux-immutable-state-invariant
and redux-devtools-extension
dependencies, and modifies the types for createEntityAdapter
.
Changes
Dependency Updates and Bundle Size
Since its creation, RTK has depended on leoasis/redux-immutable-state-invariant
to throw errors if accidental mutations are detected, and the zalmoxisus/redux-devtools-extension
NPM package to handle setup and configuration of the Redux DevTools Extension as the store is created.
Unfortunately, neither of these dependencies is currently published as ES Modules, and we recently found out that the immutable middleware was actually being included in production bundles despite our attempts to ensure it is excluded.
Given that the repo for the immutable middleware has had no activity in the last 3 years, we've opted to fork the package and include the code directly inside Redux Toolkit. We've also inlined the tiny-invariant
and json-stringify-safe
packages that the immutable middleware depended on.
The DevTools setup package, while tiny, suffers from the same issue, and so we've forked it as well.
Based on tests locally, these changes should reduce your production bundle sizes by roughly 2.5K minified.
As a future note, Immer is currently being reworked to enable better shakeability, and once that is released, we plan on updating RTK to use the new Immer version as well. This is unlikely to make it into RTK 1.3.0, but we'll put out another update once we've been able to confirm that the changes work for us.
createEntityAdapter
Types
We made a few more tweaks to the type definitions for createEntityAdapter
. Shouldn't be anything breaking, but clarifying the possible overloads for the generated methods.
Changelog
- Immutable middleware cleanup (@markerikson - #385)
- Feature/immutable invariant (@msutkowski - #381)
- Fork redux-devtools-extension (@markerikson - #384)
- remove
any
where applicable (@phryneas - #377)