1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Merge pull request #43 from Unleash/redux-devtools

Add redux dev tools in development
This commit is contained in:
Sveinung Røsaker 2017-01-06 12:45:02 +01:00 committed by GitHub
commit 6085c38485
3 changed files with 25 additions and 14 deletions

View File

@ -10,6 +10,9 @@
"commonjs": true,
"es6": true
},
"globals": {
"process": false
},
"parserOptions": {
"ecmaVersion": 7,
"ecmaFeatures": {

View File

@ -8,7 +8,7 @@ import { applyRouterMiddleware, Router, Route, IndexRedirect, hashHistory } from
import { useScroll } from 'react-router-scroll';
import { Provider } from 'react-redux';
import thunkMiddleware from 'redux-thunk';
import { createStore, applyMiddleware } from 'redux';
import { createStore, applyMiddleware, compose } from 'redux';
import store from './store';
import App from './component/app';
@ -25,10 +25,18 @@ import Archive from './page/archive';
import Applications from './page/applications';
import ApplicationView from './page/applications/view';
let composeEnhancers;
if (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
} else {
composeEnhancers = compose;
}
const unleashStore = createStore(
store,
applyMiddleware(
thunkMiddleware
composeEnhancers(
applyMiddleware(thunkMiddleware)
)
);

View File

@ -6,21 +6,21 @@ const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const entry = ['whatwg-fetch', './src/index'];
const plugins = [new ExtractTextPlugin('bundle.css', { allChunks: true })];
const plugins = [
new ExtractTextPlugin('bundle.css', { allChunks: true }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
},
}),
];
if (process.env.NODE_ENV === 'development') {
entry.push('webpack-dev-server/client?http://localhost:3000');
entry.push('webpack/hot/only-dev-server');
plugins.push(new webpack.HotModuleReplacementPlugin());
} else {
plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}));
}
module.exports = {
entry,
@ -38,15 +38,15 @@ module.exports = {
module: {
loaders: [
{
test: /\.(jsx|js)$/,
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['babel'],
loader: 'babel',
include: path.join(__dirname, 'src'),
},
{
test: /(\.scss)$/,
loader: ExtractTextPlugin.extract('style',
'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass'),
'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass'),
},
{
test: /\.css$/,