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:
commit
6085c38485
@ -10,6 +10,9 @@
|
|||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
|
"globals": {
|
||||||
|
"process": false
|
||||||
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 7,
|
"ecmaVersion": 7,
|
||||||
"ecmaFeatures": {
|
"ecmaFeatures": {
|
||||||
|
@ -8,7 +8,7 @@ import { applyRouterMiddleware, Router, Route, IndexRedirect, hashHistory } from
|
|||||||
import { useScroll } from 'react-router-scroll';
|
import { useScroll } from 'react-router-scroll';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import thunkMiddleware from 'redux-thunk';
|
import thunkMiddleware from 'redux-thunk';
|
||||||
import { createStore, applyMiddleware } from 'redux';
|
import { createStore, applyMiddleware, compose } from 'redux';
|
||||||
|
|
||||||
import store from './store';
|
import store from './store';
|
||||||
import App from './component/app';
|
import App from './component/app';
|
||||||
@ -25,10 +25,18 @@ import Archive from './page/archive';
|
|||||||
import Applications from './page/applications';
|
import Applications from './page/applications';
|
||||||
import ApplicationView from './page/applications/view';
|
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(
|
const unleashStore = createStore(
|
||||||
store,
|
store,
|
||||||
applyMiddleware(
|
composeEnhancers(
|
||||||
thunkMiddleware
|
applyMiddleware(thunkMiddleware)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6,21 +6,21 @@ const webpack = require('webpack');
|
|||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
|
||||||
const entry = ['whatwg-fetch', './src/index'];
|
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') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
entry.push('webpack-dev-server/client?http://localhost:3000');
|
entry.push('webpack-dev-server/client?http://localhost:3000');
|
||||||
entry.push('webpack/hot/only-dev-server');
|
entry.push('webpack/hot/only-dev-server');
|
||||||
plugins.push(new webpack.HotModuleReplacementPlugin());
|
plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||||
} else {
|
|
||||||
plugins.push(new webpack.DefinePlugin({
|
|
||||||
'process.env': {
|
|
||||||
NODE_ENV: JSON.stringify('production'),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry,
|
entry,
|
||||||
|
|
||||||
@ -38,15 +38,15 @@ module.exports = {
|
|||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
{
|
{
|
||||||
test: /\.(jsx|js)$/,
|
test: /\.jsx?$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loaders: ['babel'],
|
loader: 'babel',
|
||||||
include: path.join(__dirname, 'src'),
|
include: path.join(__dirname, 'src'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /(\.scss)$/,
|
test: /(\.scss)$/,
|
||||||
loader: ExtractTextPlugin.extract('style',
|
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$/,
|
test: /\.css$/,
|
||||||
|
Loading…
Reference in New Issue
Block a user