Skip to content

Commit a53ead3

Browse files
disabled redux in production
1 parent 8db7c99 commit a53ead3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.env-sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ SEARCH_SUGGESTION_SERVICE_PORT=10000
2020
ACTIVE_PROFILE=dev
2121
REDIS_PASSWORD=mypass
2222
REDIS_PORT=6379
23+
ENVIRONMENT=prod

client/src/index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,21 @@ import '../src/styles/library/swiper/swiper.min.css';
1313
import log from 'loglevel';
1414
import ErrorBoundary from "./ErrorBoundary";
1515

16-
console.log = console.error = console.warn = function() {}
17-
log.disableAll(true)
18-
// log.setLevel("info")
16+
let composeEnhancers
17+
18+
// enable logs & redux only in production.
19+
if (process.env.ENVIRONMENT === "dev") {
20+
21+
// by default set the level to info
22+
log.setLevel("info")
23+
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose();
24+
} else {
25+
console.log = console.error = console.warn = function () {}
26+
log.disableAll(true)
27+
composeEnhancers = compose();
28+
}
29+
1930

20-
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose();
2131
const store = createStore(
2232
reducers,
2333
composeEnhancers(applyMiddleware(thunk))

0 commit comments

Comments
 (0)