1.vue打包
(1)package.json增加打包命令
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 10.16.14.110",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"build": "node build/build.js",
"build:prod": "webpack-dev-server build",
"build:stage": "webpack-dev-server build --mode staging"
},
(2)指定打包后的文件名(index.js)
(3)打包
2.nginx部署
(1)上传dist文件到Nginx
(2)修改配置文件
server {
listen 8099;#启动端口
server_name localhost;#本机IP
location / {
#add_header Access-Control-Allow-Origin "*";
root html/sso;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api {
proxy_pass http://后端接口地址;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html/sso;
}
}
3.重启nginx
4.访问流程