在线运行 vue dist 打包文件
背景:想在打包部署到线上前先在本地跑一遍。
- 安装 live-server
npm install -g live-server
- 根据环境打包
npm run build:development
- 启动 dist 文件夹
cd project/dist
live-server
补充:LiveServer 扩展的 Vscode setting 设置
{
"liveServer.settings.host": "localhost", //域名或IP
"liveServer.settings.port": 8000, //端口
"liveServer.settings.wait": 1000, //刷新频率
"liveServer.settings.CustomBrowser": "chrome", //打开到目标浏览器
"liveServer.settings.ChromeDebuggingAttachment": false, //是否开启ChromeDebug
"liveServer.settings.proxy": { //代理设置
//是否开启代码设置
"enable": true,
//设置为"/app"后,通过“Open with Live Server”打开的工程下的任何文件,都会在url前附上 /app 前缀
"baseUri": "/app",
//代理网址
"proxyUri": "http://localhost:8080/app"
},
}