How can you specify UI port for lite-server?

前端 未结 2 378
一个人的身影
一个人的身影 2020-12-11 16:16

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

lite-server -- port 8000

Which gives you the following result:

<         


        
相关标签:
2条回答
  • 2020-12-11 16:55

    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)

    0 讨论(0)
  • 2020-12-11 17:06

    just too add, for slow thinkers like me, to run lite-server on different port, create file bs-config.json in root of your project (or whereever you are running lite-server from) and add this into your bs-config.json

    {
        "port": 8080
    }
    

    this will run lite server on port 8080

    alternativelly you can just pass path of the bs-config.json on running lite-server

    lite-server -c configs/my-bs-config.json
    

    source: https://github.com/johnpapa/lite-server#custom-configuration

    0 讨论(0)
提交回复
热议问题