How can you specify UI port for lite-server?

MrLehiste picture MrLehiste · Feb 20, 2016 · Viewed 16.1k times · Source

When you start up lite-server, you can specify port for example

lite-server -- port 8000

Which gives you the following result:

[BS] Access URLs:
 ------------------------------------
       Local: http://localhost:8000
    External: http://192.168.0.5:8000
 ------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.0.5:3001

How can I change the port for UI which is 3001 by default (either command line and/or in bs-config.json file), to like 8001?

Answer

MrLehiste picture MrLehiste · Feb 20, 2016

Since lite-server uses browsersync, it can be changed via BrowserSync options

Not sure about command line parameter, but bs-config.json works like this:

{
  "port": 8000,
  "files": ["./dist/**/*.{html,htm,css,js}"],
  "server": { "baseDir": "./" },
  "ui": {
    "port": 8001
  }
}

BrowserSync command line options (that also work with lite-server)