Skip to content

Merge dev and prod to index in store #182

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

Merged
merged 1 commit into from
Jul 8, 2016
Merged
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
24 changes: 0 additions & 24 deletions src/store/configureStore.dev.js

This file was deleted.

35 changes: 31 additions & 4 deletions src/store/configureStore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
if (process.env.NODE_ENV === 'production') {
module.exports = require('./configureStore.prod');
} else {
module.exports = require('./configureStore.dev');
// This file merely configures the store for hot reloading.
// This boilerplate file is likely to be the same for each project that uses Redux.
// With Redux, the actual stores are in /reducers.

import { createStore, compose } from 'redux';
import rootReducer from '../reducers';

const isProduction = 'production' === process.env.NODE_ENV;

let enhancer;

if (!isProduction) {
enhancer = compose(
// Add other middleware on this line...
window.devToolsExtension ? window.devToolsExtension() : f => f // add support for Redux dev tools
);
}


export default function configureStore(initialState) {
const store = createStore(rootReducer, initialState, enhancer);

if (!isProduction && module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers').default; // eslint-disable-line global-require
store.replaceReducer(nextReducer);
});
}

return store;
}
6 changes: 0 additions & 6 deletions src/store/configureStore.prod.js

This file was deleted.