Disable redux logger middleware on production build
@@ -8,17 +8,22 @@ import loggerMiddleware from "../middleware/logger";
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
-export default function configureStore() {
- return createStore(
- rootReducer,
- composeEnhancers(
- applyMiddleware(
+const DEBUG = false;
+
+let middleware = [
thunk,
electronMiddleware,
buildGameMiddleware,
- musicMiddleware,
- loggerMiddleware
- )
- )
+ musicMiddleware
+];
+
+if (process.env.NODE_ENV !== "production" && DEBUG) {
+ middleware = [...middleware, loggerMiddleware];
+}
+
+export default function configureStore() {
+ return createStore(
+ rootReducer,
+ composeEnhancers(applyMiddleware(...middleware))
);
}
