github reduxjs/redux-toolkit v2.0.0-alpha.1

pre-release22 months ago

This is an alpha release for Redux Toolkit 2.0. This release has breaking changes.

Changelog

ESM Migration

As a literally-major part of the Redux Toolkit 2.0 alpha development work, we've migrated the package definition to be a full {type: "module"} ESM package (with CJS still included for compatibility purposes).

We've done local testing of the published package in several different build tools and environments:

  • Vite 4
  • Create React App 4 and 5
  • Next 13
  • Parcel 2
  • Node 18 (importing as CJS and ESM)

We have not tested it in React Native projects yet, or other non-React projects.

So far, the package structure seems to work okay in each of those environments, but we ask the community to try out this alpha in your own projects and report any breakages you find!

While it's not strictly related to the ESM migration, one potential compat issue is that we no longer transpile any of our build artifacts (other than removing TS syntax), and we do use the optional chaining operator ( ?. ). It's likely that Webpack 4 will find the correct ESM build artifact, but not be able to parse that syntax. You'll need to either upgrade to Webpack 5, or modify your Webpack config to transpile the RTK build artifacts that are imported from node_modules.

Redux-Thunk 3.0 Alpha

Along with the RTK package, we've migrated redux-thunk to ESM as well and published that as 3.0.0-alpha.1. That release also drops the existing default export, and instead has named exports: import { thunk, withExtraArgument } from 'redux-thunk'.

This should not meaningfully affect RTK users, as configureStore already sets up the thunk middleware for you.

Vitest Migration

We've migrated our own test suite from Jest to Vitest, fixing a couple of compat issues.

Related Future Work

Michel Weststrate, author of Immer, has published a roadmap for Immer 10.0. This includes modernization by dropping non-Proxy ES5 compat, dropping the default export, performance improvements, and more. We plan to include Immer 10 in RTK 2.0.

We're restarting discussion around possible additional changes to Reselect in a v5 major version, and would appreciate feedback on possible improvements there.

See the RTK 2.0 planning thread for other work we're considering for 2.0.

What's Changed

Full Changelog: v2.0.0-alpha.0...v2.0.0-alpha.1

Don't miss a new redux-toolkit release

NewReleases is sending notifications on new releases.