开启本地服务器
1、vite.config.json
// vite.config.js
server: {
host: '0.0.0.0',
open: true,
proxy: {
'/api': {
target: 'https://devwxapp.rhecube.com',
pathRewrite: {
['^/api']: ''
},
changeOrigin: true
}
}
},
2、项目编译
npm run build
// package.json
"scripts": {
"dev": "vite",
"build": "vite build"
}
3、启动本地服务器
3.1 进入dist目录
cd dist
3.2 启动服务
http-server -P https://xxx.com --cors
- xxx.com 为服务器地址
4、打开系统
- 在浏览器中输入 http://127.0.0.1:8080 , 应用正常打开