Skip to content

Commit 0b6ff2e

Browse files
feat( host ): add listen host passed as option
1 parent 3717ac9 commit 0b6ff2e

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

bin/webpack-super-dev-server

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
const Server = require( '../' );
44

5-
const exampleText = 'webpack-super-dev-server -p 9000 --proxy http://localhost:3000 --proxyPath /api --mockConfig mockConfig1.json --mockConfig mockConfig2.json';
6-
const exampleWillDoText = 'Will start server on port 3000 and will proxy /api requests to http://localhost:3000 and repond with mockConfig1.json and mockConfig2.json mocks';
5+
const exampleText = 'webpack-super-dev-server -p 9000 -h 0.0.0.0 --proxy http://localhost:3000 --proxyPath /api --mockConfig mockConfig1.json --mockConfig mockConfig2.json';
6+
const exampleWillDoText = 'Will start server on 0.0.0.0:3000 and will proxy /api requests to http://localhost:3000 and repond with mockConfig1.json and mockConfig2.json mocks';
77

88
const argv = require( 'yargs' )
99
.usage( 'Usage: $0 [options]' )
@@ -18,6 +18,12 @@ const argv = require( 'yargs' )
1818
default: 'app',
1919
type: 'string'
2020
})
21+
.option( 'host', {
22+
alias: 'h',
23+
describe: 'Dev server host ip',
24+
default: 'localhost',
25+
type: 'string'
26+
})
2127
.option( 'port', {
2228
alias: 'p',
2329
describe: 'Dev server port',

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function SuperServer( options ) {
6060

6161
}
6262

63-
server.listen( options.port, 'localhost' );
63+
server.listen( options.port, options.host );
6464

6565

6666
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-super-dev-server",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Webpack server with Mock and Proxy support",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)