增加打包配置

This commit is contained in:
BianLzhaoMin 2025-12-26 14:32:10 +08:00
parent 06d22c9a2b
commit 55663cc9d2
5 changed files with 13 additions and 7 deletions

View File

@ -6,3 +6,6 @@ VITE_APP_ENV = 'development'
# 运检站管理/开发环境
VITE_APP_BASE_API = '/dev-api'
#静态资源路径(服务器目录)
VITE_APP_PUBLIC_PATH = ''

View File

@ -5,7 +5,10 @@ VITE_APP_TITLE = 运检站管理
VITE_APP_ENV = 'production'
# 运检站管理/生产环境
VITE_APP_BASE_API = '/prod-api'
VITE_APP_BASE_API = '/ynDigitalGadgets-prod-api'
#静态资源路径(服务器目录)
VITE_APP_PUBLIC_PATH = '/ynDigitalGadgets'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip

View File

@ -194,7 +194,7 @@ export const dynamicRoutes = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHistory(import.meta.env.VITE_APP_PUBLIC_PATH || '/'),
routes: constantRoutes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {

View File

@ -11,9 +11,9 @@
<el-form
ref="formRef"
:model="formData"
:rules="rules"
label-width="auto"
:rules="!isDetail ? rules : {}"
size="large"
label-width="auto"
:disabled="isDetail"
>
<el-row :gutter="24">

View File

@ -3,8 +3,8 @@ import path from 'path'
import createVitePlugins from './vite/plugins'
// const baseUrl = 'http://192.168.0.133:58080' // 后端接口地址 超子
// const baseUrl = 'http://localhost:58080' // 后端接口地址
const baseUrl = 'http://192.168.0.60:58080' // 后端接口地址 福海
const baseUrl = 'http://localhost:58080' // 后端接口地址
// const baseUrl = 'http://192.168.0.60:58080' // 后端接口地址 福海
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
@ -16,7 +16,7 @@ export default defineConfig(({ mode, command }) => {
// 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
base: VITE_APP_ENV === 'production' ? '/' : '/',
base: VITE_APP_ENV === 'production' ? '/ynDigitalGadgets' : '/',
plugins: createVitePlugins(env, command === 'build'),
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias