Skip to content

Commit d2677bc

Browse files
committed
docs: clean up code in examples
1 parent b240742 commit d2677bc

File tree

10 files changed

+54
-249
lines changed

10 files changed

+54
-249
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ module.exports = api => {
9595
// ... other options
9696
plugins: [
9797
// ... other plugins
98-
// Applies the react-refresh Babel plugin on development modes only
99-
api.env('development') && 'react-refresh/babel',
98+
// Applies the react-refresh Babel plugin on non-production modes only
99+
!api.env('production') && 'react-refresh/babel',
100100
].filter(Boolean),
101101
};
102102
};

examples/cra-kitchen-sink/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "cra-kitchen-sink",
33
"version": "0.1.0",
4+
"author": "Michael Mok",
5+
"license": "MIT",
46
"private": true,
57
"dependencies": {
68
"react": "^16.12.0",

examples/cra-kitchen-sink/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
27+
<title>CRA React App</title>
2828
</head>
2929
<body>
3030
<noscript>You need to enable JavaScript to run this app.</noscript>

examples/wds-kitchen-sink/babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = api => {
33
api.cache.using(() => process.env.NODE_ENV);
44
return {
55
presets: ['@babel/preset-env', '@babel/preset-react'],
6-
// Applies the react-refresh Babel plugin on development mode only
7-
...(api.env('development') && { plugins: ['react-refresh/babel'] }),
6+
// Applies the react-refresh Babel plugin on non-production modes only
7+
...(!api.env('production') && { plugins: ['react-refresh/babel'] }),
88
};
99
};

examples/wds-kitchen-sink/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
{
22
"name": "wds-kitchen-sink",
33
"version": "0.1.0",
4-
"main": "index.js",
54
"author": "Michael Mok",
65
"license": "MIT",
76
"private": true,
8-
"scripts": {
9-
"start": "webpack-dev-server --hot --mode development",
10-
"build": "cross-env NODE_ENV=production webpack --mode production"
11-
},
127
"dependencies": {
138
"react": "^16.9.0",
149
"react-dom": "^16.9.0"
@@ -25,5 +20,9 @@
2520
"webpack": "^4.41.3",
2621
"webpack-cli": "^3.3.9",
2722
"webpack-dev-server": "^3.9.0"
23+
},
24+
"scripts": {
25+
"start": "webpack-dev-server --hot --mode development",
26+
"build": "cross-env NODE_ENV=production webpack --mode production"
2827
}
2928
}

examples/wds-kitchen-sink/webpack.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
const ReactRefreshPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
12
const HtmlWebpackPlugin = require('html-webpack-plugin');
2-
const ReactRefreshPlugin = require('../../src');
33

44
module.exports = {
5-
entry: './src/index.js',
5+
entry: {
6+
main: './src/index.js',
7+
},
68
module: {
79
rules: [
810
{

0 commit comments

Comments
 (0)