Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check self.process before reading for browser compatibility #2910

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/combineReducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function combineReducers(reducers) {
for (let i = 0; i < reducerKeys.length; i++) {
const key = reducerKeys[i]

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

let unexpectedKeyCache
if (process.env.NODE_ENV !== 'production') {
if (typeof process === 'object' && process.env.NODE_ENV !== 'production') {
unexpectedKeyCache = {}
}

Expand All @@ -150,7 +150,7 @@ export default function combineReducers(reducers) {
throw shapeAssertionError
}

if (process.env.NODE_ENV !== 'production') {
if (typeof process === 'object' && process.env.NODE_ENV !== 'production') {
const warningMessage = getUnexpectedStateShapeWarningMessage(
state,
finalReducers,
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import __DO_NOT_USE__ActionTypes from './utils/actionTypes'
function isCrushed() {}

if (
typeof process === 'object' &&
process.env.NODE_ENV !== 'production' &&
typeof isCrushed.name === 'string' &&
isCrushed.name !== 'isCrushed'
Expand Down