Redux Bundler is a pragmatic state management library that facilitates building Redux stores by composing smaller, self-contained units of functionality called 'bundles.' Designed with Progressive Web Apps (PWAs) in mind, it emphasizes small bundle sizes, network resilience, and explicit state management, aiming to reduce the boilerplate often associated with traditional Redux setups. It formalizes an opinionated 'ducks pattern,' consolidating actions, reducers, and selectors for a specific feature into a single bundle file. The library provides a convention-over-configuration approach for managing side effects through 'reactors' and includes a lightweight, optional routing system. While it leverages and re-exports much of Redux's core functionality, it offers an alternative to Redux Toolkit, providing a distinct organizational structure and patterns. The current stable version is 29.1.0, with a rapid release cadence often including major version bumps even for non-breaking changes to ensure safety. It uniquely supports running entirely within a WebWorker and enables code-splitting and lazy-loading of Redux logic.
npm install redux-bundlerVerified import paths — ran on the pinned version, not inferred.
This example demonstrates defining a simple user bundle with a reducer, selectors, and action creators. It then composes this bundle to create a Redux store, dispatches actions, and shows how to select state and subscribe to changes.
Thoroughly review the `CHANGELOG.md` file or the documentation site (reduxbundler.com) for any specific migration steps required for your version upgrade. Pay close attention to changes in bundle configuration options or internal mechanics.
Remove `redux` and `reselect` from your project's `package.json` if they are direct dependencies. Import Redux utilities (like `createStore`, `combineReducers`) and `createSelector` directly from `redux-bundler`.
Configure your build tools (e.g., Webpack, Rollup) to set `process.env.NODE_ENV = 'production'` when building for production environments. This will enable dead-code elimination for debug-only code.
Update calls to `createCacheBundle` to pass an options object, for example: `createCacheBundle({ cacheFn: yourCacheFunction, enabled: true })`.Upgrade to `redux-bundler` version 28.0.1 or higher. If upgrading is not immediately possible, consider explicitly binding these functions to `window` or `globalThis` where they are used.
Ensure all reducers adhere to immutability principles. Always return new state objects or arrays using spread syntax (`{...state, ...}`, `[...arr, item]`) or immutable utility libraries.Check the `getReducer` of the relevant bundle to ensure it defines an appropriate `initialState` with all expected nested properties. Also, verify that any bundles providing data for this selector are correctly integrated.
Verify the action `type` string exactly matches a `case` in one of your reducers. Ensure the bundle containing the intended reducer is included in the `composeBundles` call.
No dependency data recorded yet.