Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Migrated project to react-hot-loader 3.0-alpha12 This closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
skolmer committed Apr 25, 2016
1 parent 11b7290 commit d63228d
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 2,323 deletions.
11 changes: 5 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"presets": [
"react",
"es2015"
"presets": [
"es2015",
"stage-0",
"react"
],
"env": {
"development": {
"presets": [
"react-hmre"
]
"plugins": ["react-hot-loader/babel"]
}
}
}
34 changes: 13 additions & 21 deletions devServer.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
/*eslint no-console: 0*/
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.config.dev');

const app = express();
const compiler = webpack(config);
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true
}
}).listen(3000, 'localhost', function (err) {
if (err) {
console.log(err);
}

app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));

app.use(require('webpack-hot-middleware')(compiler));

app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, 'index.html'));
});

app.listen(3000, 'localhost', function(err) {
if (err) {
console.log(err);
return;
}
console.log('Listening at http://localhost:3000');
console.log('Listening at localhost:3000');
});
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,21 @@
"babel-core": "^6.7.6",
"babel-eslint": "^6.0.2",
"babel-loader": "^6.2.4",
"babel-plugin-react-transform": "^2.0.2",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"babel-preset-react": "^6.5.0",
"babel-preset-react-hmre": "^1.1.1",
"cross-env": "^1.0.7",
"eslint": "^2.7.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-import": "^1.4.0",
"eslint-plugin-lodash": "^1.6.5",
"eslint-plugin-react": "^4.3.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.13.4",
"ghooks": "^1.2.1",
"html-webpack-plugin": "^2.15.0",
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.3",
"react-hot-loader": "^3.0.0-alpha.12",
"rimraf": "^2.5.2",
"webpack": "^1.12.15",
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0"
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"lodash": "^4.11.1",
Expand Down
19 changes: 18 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import App from './App';

render(<App />, document.getElementById('root'));
render(
<AppContainer
component={App}
/>,
document.getElementById('root')
);

if (module.hot) {
module.hot.accept('./App', () => {
render(
<AppContainer
component={require('./App').default}
/>,
document.getElementById('root')
);
});
}
6 changes: 2 additions & 4 deletions typings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"ambientDependencies": {
"express": "registry:dt/express#4.0.0+20160317120654",
"express-serve-static-core": "registry:dt/express-serve-static-core#0.0.0+20160317120654",
"lodash": "registry:dt/lodash#3.10.0+20160330154726",
"node": "registry:dt/node#4.0.0+20160317120654",
"react": "registry:dt/react#0.14.0+20160316155526",
"webpack": "registry:dt/webpack#1.12.9+20160316155526"
"react": "registry:dt/react#0.14.0+20160423065914",
"webpack": "registry:dt/webpack#1.12.9+20160321060707"
}
}
1 change: 1 addition & 0 deletions typings/browser.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/// <reference path="browser/ambient/lodash/index.d.ts" />
/// <reference path="browser/ambient/react/index.d.ts" />
/// <reference path="browser/ambient/webpack/index.d.ts" />
Loading

0 comments on commit d63228d

Please sign in to comment.