Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Feb 24, 2017
1 parent b5adc61 commit 6ab91f8
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 79 deletions.
25 changes: 7 additions & 18 deletions example/react/App.js
@@ -1,20 +1,9 @@
import React from 'react';

import React, { Component } from 'react';
import Layout from './Layout';
import Counter from './Counter';
const App = () => (
<div>
<h2>Hello, !!aa</h2>
</div>
);

// If you use React Router, make this component
// render <Router> with your routes. Currently,
// only synchronous routes are hot reloaded, and
// you will see a warning from <Router> on every reload.
// You can ignore this warning. For details, see:
// https://github.com/reactjs/react-router/issues/2182
export default class App extends Component {
render() {
return (
<Layout>
<Counter />
</Layout>
);
}
}
export default App;
24 changes: 0 additions & 24 deletions example/react/Counter.js

This file was deleted.

11 changes: 0 additions & 11 deletions example/react/Layout.js

This file was deleted.

21 changes: 15 additions & 6 deletions example/react/index.js
@@ -1,16 +1,25 @@
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import ReactDOM from 'react-dom';

import { AppContainer } from 'react-hot-loader';
// AppContainer is a necessary wrapper component for HMR

import App from './App';

const rootEl = document.getElementById('app');
const render = Component =>
const render = (Component) => {
ReactDOM.render(
<AppContainer>
<Component />
<Component/>
</AppContainer>,
rootEl
document.getElementById('app')
);
};

render(App);
if (module.hot) module.hot.accept('./App', () => render(App));

// Hot Module Replacement API
if (module.hot) {
module.hot.accept('./App', () => {
render(App)
});
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -19,9 +19,9 @@
"tooling": {
"presets": [
[
"vue",
"react",
{
"entry": "example/vue/index.js"
"entry": "example/react/index.js"
}
]
]
Expand Down
3 changes: 1 addition & 2 deletions packages/tooling-preset-react/index.js
Expand Up @@ -6,8 +6,7 @@ module.exports = function ({config, type, inherit, options}) {
if (type === 'dev') {
config
.entry('web-client')
.prepend(require.resolve('react-hot-loader/patch'))
.end()
.prepend('react-hot-loader/patch')
}

config
Expand Down
2 changes: 1 addition & 1 deletion packages/tooling-preset-react/package.json
Expand Up @@ -34,6 +34,6 @@
"babel-preset-react-app": "^2.1.0",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-hot-loader": "next"
"react-hot-loader": "^3.0.0-beta.6"
}
}
11 changes: 2 additions & 9 deletions packages/tooling-preset-react/yarn.lock
Expand Up @@ -772,20 +772,13 @@ babel-register@^6.23.0:
mkdirp "^0.5.1"
source-map-support "^0.4.2"

babel-runtime@6.22.0:
babel-runtime@6.22.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0:
version "6.22.0"
resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.10.0"

babel-runtime@^6.18.0, babel-runtime@^6.22.0:
version "6.23.0"
resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b"
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.10.0"

babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0, babel-template@^6.7.0:
version "6.23.0"
resolved "https://registry.npmjs.org/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638"
Expand Down Expand Up @@ -3146,7 +3139,7 @@ react-dom@^15.4.2:
loose-envify "^1.1.0"
object-assign "^4.1.0"

react-hot-loader@next:
react-hot-loader@^3.0.0-beta.6:
version "3.0.0-beta.6"
resolved "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-3.0.0-beta.6.tgz#463fac0bfc8b63a8385258af20c91636abce75f4"
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions packages/tooling-preset-web/index.js
Expand Up @@ -70,12 +70,12 @@ module.exports = function ({type, config, options}) {
.end()
.end()
.module
.rule('web-js')
.rule('web-compile-js')
.test(/\.jsx?$/)
.exclude([/node_modules/])
.loader('babel', 'babel-loader')
.end()
.rule('web-es6')
.rule('web-compile-es6')
.test(/\.es6$/)
.loader('babel', 'babel-loader')
.end()
Expand Down
2 changes: 1 addition & 1 deletion packages/tooling/package.json
Expand Up @@ -38,7 +38,7 @@
"cac": "^3.0.4",
"chalk": "^1.1.3",
"connect-history-api-fallback": "^1.3.0",
"conpack": "^0.1.1",
"conpack": "^0.1.2",
"cosmiconfig": "^2.1.1",
"express": "^4.14.1",
"http-proxy-middleware": "^0.17.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/tooling/yarn.lock
Expand Up @@ -732,9 +732,9 @@ connect-history-api-fallback@^1.3.0:
version "1.3.0"
resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.3.0.tgz#e51d17f8f0ef0db90a64fdb47de3051556e9f169"

conpack@^0.1.1:
version "0.1.1"
resolved "https://registry.npmjs.org/conpack/-/conpack-0.1.1.tgz#179a84301ca13e5bdda557782adb19801e10bc63"
conpack@^0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/conpack/-/conpack-0.1.2.tgz#49d6c059fb178d46ca7291834b1559ef0702e521"
dependencies:
map-to-obj "^0.2.0"

Expand Down

0 comments on commit 6ab91f8

Please sign in to comment.