启动lite-server时,可以指定端口
lite-server -- port 8000
Run Code Online (Sandbox Code Playgroud)
这给你以下结果:
[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
Run Code Online (Sandbox Code Playgroud)
如何更改UI的端口默认为3001(命令行和/或bs-config.json文件),类似8001?
MrL*_*ste 15
由于lite-server使用browsersync,因此可以通过BrowserSync选项进行更改
不确定命令行参数,但是这样bs-config.json工作:
{
"port": 8000,
"files": ["./dist/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./" },
"ui": {
"port": 8001
}
}
Run Code Online (Sandbox Code Playgroud)
BrowserSync命令行选项(也适用于lite-server)
对于像我这样的慢速思考者来说,只需要在不同的端口上运行lite-server,在项目的根目录中创建文件bs-config.json(或者在运行lite-server时),并将其添加到bs-config中以.json
{
"port": 8080
}
Run Code Online (Sandbox Code Playgroud)
这将在端口8080上运行lite服务器
另外,你可以在运行的lite-server上传递bs-config.json的路径
lite-server -c configs/my-bs-config.json
Run Code Online (Sandbox Code Playgroud)
来源:https://github.com/johnpapa/lite-server#custom-configuration
| 归档时间: |
|
| 查看次数: |
12965 次 |
| 最近记录: |