Skip to content

Commit e7a0bbc

Browse files
committed
Just use webpack dev serve to develop.
1 parent b04d2eb commit e7a0bbc

File tree

5 files changed

+15
-39
lines changed

5 files changed

+15
-39
lines changed

config/default.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
</p>
1515
</div>
1616
<a href="https://github.com/kelp404/react-hooks-shared-state"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
17-
<script type="text/javascript" src="http://localhost:8001/app.js"></script>
17+
<script type="text/javascript" src="/app.js"></script>
1818
</body>
1919
</html>

example/server.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "A global state for React with Hooks API.",
55
"main": "index.js",
66
"scripts": {
7-
"start": "concurrently --kill-others \"./node_modules/webpack-dev-server/bin/webpack-dev-server.js\" \"./node_modules/nodemon/bin/nodemon.js example/server.js --watch example/server.js\"",
8-
"build": "./node_modules/webpack/bin/webpack.js --mode=production",
7+
"start": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
8+
"build": "./node_modules/webpack/bin/webpack.js --env.mode=production",
99
"test": "echo \"Error: no test specified\" && exit 1",
1010
"ncu": "./node_modules/npm-check-updates/bin/ncu"
1111
},
@@ -34,17 +34,13 @@
3434
"@babel/preset-env": "7.4.3",
3535
"@babel/preset-react": "7.0.0",
3636
"babel-loader": "8.0.5",
37-
"concurrently": "4.1.0",
38-
"config": "3.1.0",
3937
"eslint": "5.16.0",
4038
"eslint-config-xo": "0.26.0",
4139
"eslint-config-xo-react": "0.19.0",
4240
"eslint-config-xo-space": "0.21.0",
4341
"eslint-plugin-react": "7.12.4",
4442
"eslint-plugin-react-hooks": "1.6.0",
45-
"express": "4.16.4",
4643
"jest": "24.7.1",
47-
"nodemon": "1.18.11",
4844
"npm-check-updates": "3.1.8",
4945
"react-dom": "16.8.6",
5046
"webpack": "4.30.0",

webpack.config.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
const path = require('path');
22

3-
module.exports = () => ({
3+
module.exports = (env = {}) => ({
44
target: 'web',
5-
mode: 'development',
5+
mode: env.mode || 'development',
66
entry: {
77
app: path.join(__dirname, 'example', 'app.js')
88
},
99
devServer: {
1010
host: 'localhost',
11-
port: 8001,
12-
headers: {
13-
'Access-Control-Allow-Origin': '*',
14-
'Access-Control-Max-Age': '3000',
15-
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
16-
'Access-Control-Allow-Methods': 'GET'
17-
}
11+
port: 8000,
12+
contentBase: path.join(__dirname, 'example'),
13+
historyApiFallback: {
14+
rewrites: [
15+
{
16+
from: /.*/,
17+
to: 'index.html'
18+
}
19+
]
20+
},
1821
},
1922
resolve: {
2023
extensions: ['.js']

0 commit comments

Comments
 (0)