fix: hot reload port should not be hardcoded in case it is used

This commit is contained in:
endiliey 2018-08-24 00:05:37 +08:00
parent 1f2c8a39a9
commit 23a85d9074

View file

@ -50,6 +50,7 @@ module.exports = async function start(siteDir, cliOptions = {}) {
} }
const port = await getPort(cliOptions.port); const port = await getPort(cliOptions.port);
const hotPort = await getPort(port + 1);
const {baseUrl} = props; const {baseUrl} = props;
// create compiler from generated webpack config // create compiler from generated webpack config
@ -79,7 +80,7 @@ module.exports = async function start(siteDir, cliOptions = {}) {
logLevel: 'silent' logLevel: 'silent'
}, },
hotClient: { hotClient: {
port: port + 1, port: hotPort,
logLevel: 'error' logLevel: 'error'
}, },
logLevel: 'error', logLevel: 'error',