static-cms/src/store/configureStore.js
Andrey Okonetchnikov 434f45c97c Webpack optimizations (#140)
* Less repetition in webpack configs. Minify CSS classnames in production.

* Ignore all optional deps of moment.js. Fixes #138

* Added target to webpack config

* Automatically extract all 3rd party modules into a separate 'vendor' chunk

* Inline only assets that are smaller than 10KB

* Added autoprefixer options

* Replaced sinfle babel transforms with the stage-1 preset. Cleaned up webpack configs.

* Do not include hot module replacement in production
2016-10-26 15:51:35 -02:00

21 lines
725 B
JavaScript

import { createStore, applyMiddleware, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import reducer from '../reducers/combinedReducer';
export default function configureStore(initialState) {
const store = createStore(reducer, initialState, compose(
applyMiddleware(thunkMiddleware),
window.devToolsExtension ? window.devToolsExtension() : f => f
));
if (process.env.NODE_ENV !== 'production' && module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers/combinedReducer', () => {
const nextReducer = require('../reducers/combinedReducer') // eslint-disable-line
store.replaceReducer(nextReducer);
});
}
return store;
}