Skip to content

Commit

Permalink
feat: add --bind option (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Feb 19, 2024
1 parent c404058 commit d23d5f5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/slidev/node/cli.ts
Expand Up @@ -96,9 +96,14 @@ cli.command(
type: 'boolean',
describe: 'force the optimizer to ignore the cache and re-bundle ',
})
.option('bind', {
type: 'string',
default: '0.0.0.0',
describe: 'specify which IP addresses the server should listen on in remote mode',
})
.strict()
.help(),
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect }) => {
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect, bind }) => {
if (!fs.existsSync(entry) && !entry.endsWith('.md'))
entry = `${entry}.md`

Expand Down Expand Up @@ -132,7 +137,7 @@ cli.command(
port,
strictPort: true,
open,
host: remote !== undefined ? '0.0.0.0' : 'localhost',
host: remote !== undefined ? bind : 'localhost',
// @ts-expect-error Vite <= 4
force,
},
Expand Down

0 comments on commit d23d5f5

Please sign in to comment.