Closed shyzz closed 3 years ago
If you run with the --remote
flag, it allows access from the network.
For me, I just added a line to my package.json
under scripts
which was "remote": "slidev --open --remote",
, which could later be run with npm run remote
.
--remote
and 0.0.0.0
are not the same when host has multiple ip address.
When the host has multiple ip address, --remote
will choose an ip randomly to host website and you can only access the website from the ip chosen by --remote
, but 0.0.0.0
will allow you to access from all of the ip addresses.
Allow user change host ip really make sense.
--remote
is just an alias to host: '0.0.0.0'
, https://github.com/slidevjs/slidev/blob/916e429debe0c5f381576b4d2e2dbd1f8e51b816/packages/slidev/node/cli.ts#L115
when you do that, please there is an security caveat you will need to be aware of https://github.com/vitejs/vite/issues/2820
We could expose the host option to specify the ip, which I could think it's quite an edge case. If you really want that, open for pr. Thanks.
answer not written in the most careful way,
the correct answer is npm run dev -- --remote
. Without the double -- --
it doesn't work.
Cli docs is also confusing, it says remote control > pass --remote to enable
and you pass --remote
and nothing changes.
answer not written in the most careful way,
the correct answer is
npm run dev -- --remote
. Without the double-- --
it doesn't work.Cli docs is also confusing, it says
remote control > pass --remote to enable
and you pass
--remote
and nothing changes.
FYI, the extra --
is for NPM. Directly execute the Slidev CLI or use PNPM doesn't require this.
because i deploy this server in my esc. when i run
npm run dev
,this server run in localhost:3030。but esc dont support visit localhost in public network. please endow me a easy way to change running ip