Skip to content

Commit d3522f5

Browse files
authored
remove createSerializableStateInvariantMiddleware and createImmutableStateInvariantMiddleware functionality from production builds (#406)
1 parent 9e29ccc commit d3522f5

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/createAsyncThunk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export function createAsyncThunk<
183183
removeEventListener() {}
184184
}
185185
abort() {
186-
if (process.env.NODE_ENV === 'development') {
186+
if (process.env.NODE_ENV !== 'production') {
187187
if (!displayedWarning) {
188188
displayedWarning = true
189189
console.info(

src/immutableStateInvariantMiddleware.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ export interface ImmutableStateInvariantMiddlewareOptions {
179179
export function createImmutableStateInvariantMiddleware(
180180
options: ImmutableStateInvariantMiddlewareOptions = {}
181181
): Middleware {
182+
if (process.env.NODE_ENV === 'production') {
183+
return () => next => action => next(action)
184+
}
185+
182186
const { isImmutable = isImmutableDefault, ignoredPaths } = options
183187
const track = trackForMutations.bind(null, isImmutable, ignoredPaths)
184188

src/serializableStateInvariantMiddleware.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ export interface SerializableStateInvariantMiddlewareOptions {
128128
export function createSerializableStateInvariantMiddleware(
129129
options: SerializableStateInvariantMiddlewareOptions = {}
130130
): Middleware {
131+
if (process.env.NODE_ENV === 'production') {
132+
return () => next => action => next(action)
133+
}
131134
const {
132135
isSerializable = isPlain,
133136
getEntries,

0 commit comments

Comments
 (0)