Commit 82a40a4cb073f093a6a898da0a5394f59757ed59
hot reloading!
Michael Williams committed on 12/26/2015, 5:24:30 AMParent: ec8f9a99f86cc12ccc1b98d421015bf52931db07
Files changed
.babelrc | changed |
app/containers/dev-root.js | added |
app/containers/root.js | deleted |
package.json | changed |
.babelrc | ||
---|---|---|
@@ -5,6 +5,22 @@ | ||
5 | 5 | ], |
6 | 6 | "plugins": [ |
7 | 7 | "transform-runtime", |
8 | 8 | "transform-object-rest-spread" |
9 | - ] | |
9 | + ], | |
10 | + "env": { | |
11 | + "hot": { | |
12 | + "plugins": [ | |
13 | + ["react-transform", { | |
14 | + "transforms": [{ | |
15 | + "transform": "react-transform-hmr", | |
16 | + "imports": ["react"], | |
17 | + "locals": ["module"] | |
18 | + }, { | |
19 | + "transform": "react-transform-catch-errors", | |
20 | + "imports": ["react", "redbox-react"] | |
21 | + }] | |
22 | + }] | |
23 | + ] | |
24 | + } | |
25 | + } | |
10 | 26 | } |
app/containers/dev-root.js | ||
---|---|---|
@@ -1,0 +1,31 @@ | ||
1 | +const React = require('react') | |
2 | +const { Provider } = require('react-redux') | |
3 | +const { ReduxRouter } = require('redux-router') | |
4 | + | |
5 | +const routes = require('app/routes') | |
6 | + | |
7 | +if (process.env.NODE_ENV === 'development') { | |
8 | + var DevTools = require('app/components/dev-tools') | |
9 | +} | |
10 | + | |
11 | +class Root extends React.Component { | |
12 | + render() { | |
13 | + const { store } = this.props; | |
14 | + | |
15 | + return ( | |
16 | + <Provider store={store}> | |
17 | + <div> | |
18 | + <ReduxRouter> | |
19 | + { routes } | |
20 | + </ReduxRouter> | |
21 | + { | |
22 | + (process.env.NODE_ENV === 'development') ? | |
23 | + <DevTools /> : null | |
24 | + } | |
25 | + </div> | |
26 | + </Provider> | |
27 | + ) | |
28 | + } | |
29 | +} | |
30 | + | |
31 | +module.exports = Root |
app/containers/root.js | ||
---|---|---|
@@ -1,31 +1,0 @@ | ||
1 | -const React = require('react') | |
2 | -const { Provider } = require('react-redux') | |
3 | -const { ReduxRouter } = require('redux-router') | |
4 | - | |
5 | -const routes = require('app/routes') | |
6 | - | |
7 | -if (process.env.NODE_ENV === 'development') { | |
8 | - var DevTools = require('app/components/dev-tools') | |
9 | -} | |
10 | - | |
11 | -class Root extends React.Component { | |
12 | - render() { | |
13 | - const { store } = this.props; | |
14 | - | |
15 | - return ( | |
16 | - <Provider store={store}> | |
17 | - <div> | |
18 | - <ReduxRouter> | |
19 | - { routes } | |
20 | - </ReduxRouter> | |
21 | - { | |
22 | - (process.env.NODE_ENV === 'development') ? | |
23 | - <DevTools /> : null | |
24 | - } | |
25 | - </div> | |
26 | - </Provider> | |
27 | - ) | |
28 | - } | |
29 | -} | |
30 | - | |
31 | -module.exports = Root |
package.json | ||
---|---|---|
@@ -9,9 +9,9 @@ | ||
9 | 9 | "format": "snazzy --format", |
10 | 10 | "test": "npm-run-all -p test:*", |
11 | 11 | "test:spec": "node spec", |
12 | 12 | "test:feature": "node feature", |
13 | - "dev:client": "watchify client -o assets/bundle.js -dv", | |
13 | + "dev:client": "BABEL_ENV=hot watchify client -o assets/bundle.js -dv -p browserify-hmr", | |
14 | 14 | "dev:assets": "cpx \"app/assets/**/*\" assets -w", |
15 | 15 | "dev:server": "node-dev server", |
16 | 16 | "prod:client": "browserify client -o assets/bundle.js -g envify -g uglifyify", |
17 | 17 | "prod:assets": "cpx \"app/assets/**/*\" assets", |
@@ -46,11 +46,16 @@ | ||
46 | 46 | "node": "^4.0.0", |
47 | 47 | "npm": "^3.0.0" |
48 | 48 | }, |
49 | 49 | "devDependencies": { |
50 | + "babel-plugin-react-transform": "github:ahdinosaur/babel-plugin-react-transform#tjk/babel-6", | |
51 | + "browserify-hmr": "^0.3.1", | |
50 | 52 | "cuke-tap": "^1.0.2", |
51 | 53 | "jsdom": "^7.1.0", |
52 | 54 | "node-dev": "^2.7.1", |
55 | + "react-transform-catch-errors": "^1.0.0", | |
56 | + "react-transform-hmr": "^1.0.1", | |
57 | + "redbox-react": "^1.2.0", | |
53 | 58 | "redux-devtools": "^3.0.0-beta-3", |
54 | 59 | "redux-devtools-dock-monitor": "^1.0.0-beta-3", |
55 | 60 | "redux-devtools-log-monitor": "^1.0.0-beta-3", |
56 | 61 | "redux-logger": "^2.0.4", |
Built with git-ssb-web