Skip to content

Commit 8727ea1

Browse files
committed
Check self.process before reading for browser compatibility
1 parent 827b627 commit 8727ea1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/combineReducers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default function combineReducers(reducers) {
121121
for (let i = 0; i < reducerKeys.length; i++) {
122122
const key = reducerKeys[i]
123123

124-
if (process.env.NODE_ENV !== 'production') {
124+
if (self.process && process.env.NODE_ENV !== 'production') {
125125
if (typeof reducers[key] === 'undefined') {
126126
warning(`No reducer provided for key "${key}"`)
127127
}
@@ -134,7 +134,7 @@ export default function combineReducers(reducers) {
134134
const finalReducerKeys = Object.keys(finalReducers)
135135

136136
let unexpectedKeyCache
137-
if (process.env.NODE_ENV !== 'production') {
137+
if (self.process && process.env.NODE_ENV !== 'production') {
138138
unexpectedKeyCache = {}
139139
}
140140

@@ -150,7 +150,7 @@ export default function combineReducers(reducers) {
150150
throw shapeAssertionError
151151
}
152152

153-
if (process.env.NODE_ENV !== 'production') {
153+
if (self.process && process.env.NODE_ENV !== 'production') {
154154
const warningMessage = getUnexpectedStateShapeWarningMessage(
155155
state,
156156
finalReducers,

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import __DO_NOT_USE__ActionTypes from './utils/actionTypes'
1313
function isCrushed() {}
1414

1515
if (
16+
self.process &&
1617
process.env.NODE_ENV !== 'production' &&
1718
typeof isCrushed.name === 'string' &&
1819
isCrushed.name !== 'isCrushed'

0 commit comments

Comments
 (0)