Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit d1d49ab

Browse files
author
Dominik Rowicki
authored
Merge pull request #47 from netguru/beta
Beta - 3.0.0
2 parents c240cbb + 82ff717 commit d1d49ab

File tree

7 files changed

+10
-28
lines changed

7 files changed

+10
-28
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ module.exports = {
4141
// This means they will be the "root" imports that are included in JS bundle.
4242
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
4343
entry: [
44-
// React Hot Loader v3
45-
require.resolve('react-hot-loader/patch'),
4644
// Include an alternative client for WebpackDevServer. A client's job is to
4745
// connect to WebpackDevServer by a socket and get notified about changes.
4846
// When you save a file, the client will either apply hot updates (in case
@@ -163,7 +161,6 @@ module.exports = {
163161
test: /\.(js|jsx|mjs)$/,
164162
include: paths.appSrc,
165163
use: [
166-
require.resolve('react-hot-loader/webpack'),
167164
{
168165
loader: require.resolve('babel-loader'),
169166
options: {

packages/react-scripts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netguru/react-scripts",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"description": "Netguru configuration and scripts for Create React App",
55
"repository": "netguru/create-react-app",
66
"license": "MIT",
@@ -77,7 +77,7 @@
7777
"devDependencies": {
7878
"react": "^16.0.0",
7979
"react-dom": "^16.0.0",
80-
"react-hot-loader": "^3.1.3",
80+
"react-hot-loader": "^4.3.2",
8181
"normalize.css": "^7.0.0"
8282
},
8383
"optionalDependencies": {

packages/react-scripts/scripts/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ module.exports = function(
101101
command = 'npm';
102102
args = ['install', '--save', verbose && '--verbose'].filter(e => e);
103103
}
104-
args.push('react', 'react-dom', 'react-hot-loader@^3.1.3', 'normalize.css');
104+
args.push('react', 'react-dom', 'react-hot-loader@^4.3.2', 'normalize.css');
105105

106106
// Install additional template dependencies, if present
107107
const templateDependenciesPath = path.join(

packages/react-scripts/template/.babelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"es2015",
55
"stage-2",
66
"react"
7-
]
7+
],
8+
"plugins": ["react-hot-loader/babel"]
89
}

packages/react-scripts/template/src/components/App/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import { hot } from 'react-hot-loader';
23
import logo from './logo.svg';
34
import LogoInline from './logo.inline.svg';
45
import styles from './style.scss';
@@ -41,4 +42,5 @@ class App extends Component {
4142
}
4243
}
4344

44-
export default App;
45+
export { App as AppUnwrapped };
46+
export default hot(module)(App);

packages/react-scripts/template/src/components/App/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import App from './index';
3+
import { AppUnwrapped as App } from './index';
44

55
it('renders without crashing', () => {
66
const div = document.createElement('div');
Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
import { AppContainer } from 'react-hot-loader';
43
import 'normalize.css';
54

65
import App from 'components/App';
76
import registerServiceWorker from 'utils/registerServiceWorker';
87

9-
function render(Component) {
10-
ReactDOM.render(
11-
<AppContainer>
12-
<Component />
13-
</AppContainer>,
14-
document.getElementById('root'),
15-
);
16-
}
17-
18-
render(App);
19-
20-
if (module.hot) {
21-
module.hot.accept('./components/App', () => {
22-
// eslint-disable-next-line global-require
23-
const nextApp = require('./components/App').default;
24-
render(nextApp);
25-
});
26-
}
8+
ReactDOM.render(<App />, document.getElementById('root'));
279

2810
registerServiceWorker();

0 commit comments

Comments
 (0)