Add /dev.html page w/ full redux dev tools

* normal page wont have store instrumented to stay lean
* reshuffled vendor deps to balance bundle sizes
This commit is contained in:
David Kaltschmidt
2016-04-28 20:00:42 +02:00
parent df593b223a
commit 85939d1248
7 changed files with 51 additions and 49 deletions

View File

@@ -7,7 +7,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from './stores/configureStore';
import configureStore from './stores/configureStore.dev';
import App from './components/app';
import DevTools from './components/dev-tools';

View File

@@ -1,5 +1,22 @@
if (process.env.NODE_ENV === 'production') {
module.exports = require('./main.prod');
} else {
module.exports = require('./main.dev');
}
require('font-awesome-webpack');
require('../styles/main.less');
require('../images/favicon.ico');
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from './stores/configureStore';
import App from './components/app';
const store = configureStore();
ReactDOM.render(
<Provider store={store}>
<div>
<App />
</div>
</Provider>,
document.getElementById('app')
);

View File

@@ -1,22 +0,0 @@
require('font-awesome-webpack');
require('../styles/main.less');
require('../images/favicon.ico');
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from './stores/configureStore';
import App from './components/app';
const store = configureStore();
ReactDOM.render(
<Provider store={store}>
<div>
<App />
</div>
</Provider>,
document.getElementById('app')
);

View File

@@ -1,5 +1,12 @@
if (process.env.NODE_ENV === 'production') {
module.exports = require('./configureStore.prod');
} else {
module.exports = require('./configureStore.dev');
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { initialState, rootReducer } from '../reducers/root';
export default function configureStore() {
return createStore(
rootReducer,
initialState,
applyMiddleware(thunkMiddleware)
);
}

View File

@@ -1,12 +0,0 @@
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { initialState, rootReducer } from '../reducers/root';
export default function configureStore() {
return createStore(
rootReducer,
initialState,
applyMiddleware(thunkMiddleware)
);
}

View File

@@ -29,6 +29,11 @@ module.exports = {
'webpack-dev-server/client?http://' + WEBPACK_SERVER_HOST + ':4041',
'webpack/hot/only-dev-server'
],
'dev-app': [
'./app/scripts/main.dev',
'webpack-dev-server/client?http://' + WEBPACK_SERVER_HOST + ':4041',
'webpack/hot/only-dev-server'
],
'contrast-app': [
'./app/scripts/contrast-main',
'webpack-dev-server/client?http://' + WEBPACK_SERVER_HOST + ':4041',
@@ -39,9 +44,10 @@ module.exports = {
'webpack-dev-server/client?http://' + WEBPACK_SERVER_HOST + ':4041',
'webpack/hot/only-dev-server'
],
vendors: ['babel-polyfill', 'classnames', 'd3', 'dagre', 'immutable',
'lodash', 'page', 'react', 'react-dom', 'react-redux', 'react-motion',
'redux', 'redux-thunk']
vendors: ['babel-polyfill', 'classnames', 'd3', 'dagre', 'filesize',
'immutable', 'lodash', 'moment', 'page', 'react',
'react-dom', 'react-motion', 'react-redux', 'redux', 'redux-thunk',
'reqwest']
},
// This will not actually create a app.js file in ./build. It is used
@@ -66,6 +72,11 @@ module.exports = {
template: 'app/html/index.html',
filename: 'terminal.html'
}),
new HtmlWebpackPlugin({
chunks: ['vendors', 'dev-app'],
template: 'app/html/index.html',
filename: 'dev.html'
}),
new HtmlWebpackPlugin({
chunks: ['vendors', 'app'],
template: 'app/html/index.html',

View File

@@ -24,8 +24,9 @@ module.exports = {
app: './app/scripts/main',
'contrast-app': './app/scripts/contrast-main',
'terminal-app': './app/scripts/terminal-main',
vendors: ['babel-polyfill', 'classnames', 'd3', 'dagre', 'immutable',
'lodash', 'page', 'react', 'react-dom', 'react-redux', 'react-motion',
// keep only some in here, to make vendors and app bundles roughly same size
vendors: ['babel-polyfill', 'classnames', 'd3', 'immutable',
'lodash', 'react', 'react-dom', 'react-redux',
'redux', 'redux-thunk']
},