Task for Start to find a free port from specified range.
npm install --save-dev start-free-port
# or
yarn add --dev start-free-port
import start from 'start';
import reporter from 'start-pretty-reporter';
import freePort from 'start-free-port';
import * as webpack from 'start-webpack';
const minPort = 3000;
const maxPort = 3099;
export const dev = () => start(reporter())(
freePort({ minPort, maxPort }, port => start(
webpack.dev(require('./conf/webpack.dev'), port)
))
);
freePort(options, callback)
options
minPort
–49152
by defaultmaxPort
–65535
by defaulthost
–'127.0.0.1'
by default
callback
– callback function which will be called with found port
List of TCP and UDP port numbers:
The range 49152–65535 contains dynamic or private ports that cannot be registered with IANA. This range is used for private, or customized services or temporary purposes and for automatic allocation of ephemeral ports.