Skip to content

Commit

Permalink
fix: port search
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 27, 2021
1 parent 834851c commit 90999cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/slidev/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cli.command(
})
.strict()
.help(),
async({ entry, theme, port, open, log, remote, force }) => {
async({ entry, theme, port: userPort, open, log, remote, force }) => {
if (!fs.existsSync(entry) && !entry.endsWith('.md'))
entry = `${entry}.md`

Expand All @@ -87,7 +87,7 @@ cli.command(
if (server)
await server.close()
const options = await resolveOptions({ entry, theme }, 'dev')
port = port || await findFreePort(3030)
const port = userPort || await findFreePort(3030)
server = (await createServer(
options,
{
Expand All @@ -105,6 +105,7 @@ cli.command(
{
server: {
port,
strictPort: true,
open,
host: remote ? '0.0.0.0' : 'localhost',
force,
Expand Down

0 comments on commit 90999cd

Please sign in to comment.