Vite下Vue3.0+Typescript项目打包
正常的打包操作
npm run build
...
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview"
},
...
没那么严肃的打包操作
npm run build
...
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
...
Nginx部署前端项目
cd /etc/nginx
vim nginx.config
// 修改内容如下,换listen端口号,server_name为服务器IP,
// location内root路径为前端文件放置处
...
include /etc/nginx/conf.d/*.conf;
server {
listen 7777;
server_name localhost;
root /usr/share/nginx/dist;
include /etc/nginx/default.d/*.conf;
location / {
root /usr/share/nginx/dist;
index index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
...