import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import vueJsx from '@vitejs/plugin-vue-jsx'; const pathSrc = path.resolve(__dirname, 'src') import tsStart from ...
}# 代理自己的项目location /cees-client {aliashtml/cees-client; index index.html;# autoindex on;try_files$uri$uri/ /cees-client/index.html;#解决刷新404}# 配置代理vite中的跨域location /client { proxy_pass http://43.136.31.72:7804; } }...
"scripts": {"dev":"vite serve --mode development","build:prod":"vue-tsc --noEmit && vite build --mode production"} 打包: npm run build:prod 方式二 通过打包时的指令配置基础路径 不用配置环境变量,vite.config.ts不用配置base属性,只需要在router/index.ts中添加: constrouter =createRouter({ ...
vite部署到nginx到二级目录 nginx怎么部署vue项目 今天要用到服务器nginx,还需要把自己的vue的项目部署到服务器上去所以就写一下记录下来。 首先要去nginx官网下下载nginx: 下载地址:https://nginx.org/en/download.html 下载下来会是一个解压包,解压到你想放的文件夹下 运行nginx.exe,然后打开浏览器输入localhost...
npm install -D vite-plugin-compression 2. 在vite.config.ts中添加插件。 exportdefault defineConfig({plugins:[viteCompression({filter: /\.(js|css|json|txt|ico|svg)(\?.*)?$/i, // 需要压缩的文件 threshold: 1024, // 文件容量大于这个值进行压缩 ...
一、 使用Vite创建Vue3项目 1.全局安装vite,使用命令npm install vite -g 2.创建vue3项目,使用命令 npm create vite@latest ,确认项目名 称,选择Vue及TypeScript 3. 使用用vscode打开项目,运行命令 npm install npm run dev 4.整个项目目录结构如下:5.访问页面 二、将打包项目发布到Nginx 1.将打包后...
解决方案:在vite.config.production.ts(生产环境的配置文件),对应的base属性设置要部署的目录‘/arcodesignpro/’,如下图: 参考文档:配置 Vite | Vite 官方中文文档 2.部署在非根服务目录下,如:部署在http://192.168.31.223:8090/arcodesignpro/下,路由跳转不正确问题; ...
Vite, Vue 3, Nginx, 部署, HMR 一、Vite与Vue 3项目构建 1.1 Vite概述与安装 Vite 是一个由 Vue.js 作者尤雨溪开发的现代前端构建工具,它专为现代浏览器和工具链设计,以其快速的冷启动和热模块更新(HMR)而闻名。Vite 的设计理念是利用原生 ES 模块导入,从而在开发过程中实现极快的启动速度和即时的模块热更...
一、申请服务器:选择云服务提供商,如腾讯云或阿里云,购买服务器。根据购买流程,完成服务器的配置和部署。确保服务器安装了最新版本的Linux操作系统。二、打包:在项目目录执行`npm run build`命令,自动编译并构建项目。构建结果默认保存在`dist`目录下。三、部署到nginx:1. 在服务器上安装nginx。2....
解决方法是采用gzip压缩技术。在vite.config.ts中添加相应的插件,进行代码构建。经过这一步骤,你会发现dist文件的大小得到了显著压缩,加载速度明显提升。接着,转向Nginx部署。首先,你需要创建一个font_dockerfile.yml文件,将Nginx配置文件从容器的/etc/nginx复制到本地的./config/nginx目录。接着编写...