Skip to content

Commit 4329604

Browse files
committed
Add settings for webpack-serve
* Cope with errors about websocket connection using Docker container * see also: webpack-contrib/webpack-serve#56 (comment)
1 parent 5b95dba commit 4329604

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Frontend boilerplate
22

33
* Node.js(w/ yarn)
4-
* Alpine
4+
* webpack
55

66
## Usage
77

88
```bash
9-
docker-compose run --rm node yarn init
9+
docker-compose up
1010
```

config/serve.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const config = require('./webpack.config');
2+
3+
module.exports = {
4+
...config,
5+
mode: 'development',
6+
serve: {
7+
host: '0.0.0.0',
8+
hot: {
9+
host: {
10+
server: '0.0.0.0',
11+
client: process.env.LOCAL_IP || '0.0.0.0'
12+
}
13+
}
14+
}
15+
};

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ services:
66
build:
77
context: .
88
dockerfile: ./docker/Dockerfile.dev
9-
command: yarn watch
9+
command: yarn start
10+
environment:
11+
LOCAL_IP: ${LOCAL_IP:-0.0.0.0}
1012
volumes:
1113
- ./:/app:${CONSISTENCY:-cached}
1214
ports:
13-
- 3000:3000
15+
- 8080:8080
16+
- 8081:8081

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"webpack-serve": "^1.0.2"
1212
},
1313
"scripts": {
14+
"start": "webpack-serve --config config/serve.config.js",
15+
"build": "webpack --config config/webpack.config.js",
1416
"watch": "webpack --config config/webpack.config.js --watch"
1517
}
1618
}

0 commit comments

Comments
 (0)