Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
Lic
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
Lic
Commits
2cce373a
提交
2cce373a
authored
12月 08, 2023
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增字段 租户标识 租户域名
上级
392e301d
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
122 行增加
和
116 行删除
+122
-116
licInformation.vue
src/views/business/licInformation.vue
+0
-0
vite.config.ts
vite.config.ts
+122
-116
没有找到文件。
src/views/business/licInformation.vue
浏览文件 @
2cce373a
差异被折叠。
点击展开。
vite.config.ts
浏览文件 @
2cce373a
import
{
defineConfig
}
from
'vite'
;
import
vue
from
'@vitejs/plugin-vue'
;
import
{
defineConfig
}
from
"vite"
;
import
vue
from
"@vitejs/plugin-vue"
;
// vite 提供的操作env配置变量的方法loadEnv
import
{
loadEnv
}
from
'vite'
;
import
{
loadEnv
}
from
"vite"
;
// nodejs写法,获取项目目录
import
path
from
'path'
;
import
path
from
"path"
;
//按需要加载
// import AutoImport from 'unplugin-auto-import/vite'
...
...
@@ -11,128 +11,135 @@ import path from 'path';
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import Icons from 'unplugin-icons/vite'
// import IconsResolver from 'unplugin-icons/resolver'
import
Inspect
from
'vite-plugin-inspect'
import
{
viteMockServe
}
from
'vite-plugin-mock'
import
{
createSvgIconsPlugin
}
from
'vite-plugin-svg-icons'
const
pathSrc
=
path
.
resolve
(
__dirname
,
'src'
)
import
Inspect
from
"vite-plugin-inspect"
;
import
{
viteMockServe
}
from
"vite-plugin-mock"
;
import
{
createSvgIconsPlugin
}
from
"vite-plugin-svg-icons"
;
const
pathSrc
=
path
.
resolve
(
__dirname
,
"src"
);
// https://vitejs.dev/config/
export
default
({
command
,
mode
})
=>
{
const
env
=
loadEnv
(
mode
,
process
.
cwd
())
return
defineConfig
({
plugins
:
[
vue
(),
createSvgIconsPlugin
({
// 指定需要缓存的图标文件夹
iconDirs
:
[
path
.
resolve
(
process
.
cwd
(),
'src/assets/icons'
)],
// 指定symbolId格式
symbolId
:
'icon-[dir]-[name]'
}),
viteMockServe
({
// default
mockPath
:
'mock'
,
}),
// AutoImport({
// // Auto import functions from Vue, e.g. ref, reactive, toRef...
// // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
// imports: ['vue'],
const
env
=
loadEnv
(
mode
,
process
.
cwd
());
return
defineConfig
({
plugins
:
[
vue
(),
createSvgIconsPlugin
({
// 指定需要缓存的图标文件夹
iconDirs
:
[
path
.
resolve
(
process
.
cwd
(),
"src/assets/icons"
)],
// 指定symbolId格式
symbolId
:
"icon-[dir]-[name]"
,
}),
viteMockServe
({
// default
mockPath
:
"mock"
,
}),
// AutoImport({
// // Auto import functions from Vue, e.g. ref, reactive, toRef...
// // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
// imports: ['vue'],
// // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
// // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
// resolvers: [
// ElementPlusResolver(),
// // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
// // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
// resolvers: [
// ElementPlusResolver(),
// // Auto import icon components
// // 自动导入图标组件
// IconsResolver({
// prefix: 'Icon',
// }),
// ],
// // Auto import icon components
// // 自动导入图标组件
// IconsResolver({
// prefix: 'Icon',
// }),
// ],
// dts: path.resolve(pathSrc, 'auto-imports.d.ts'),
// }),
// dts: path.resolve(pathSrc, 'auto-imports.d.ts'),
// }),
// Components({
// resolvers: [
// // Auto register icon components
// // 自动注册图标组件
// IconsResolver({
// enabledCollections: ['ep'],
// }),
// // Auto register Element Plus components
// // 自动导入 Element Plus 组件
// ElementPlusResolver(),
// ],
// Components({
// resolvers: [
// // Auto register icon components
// // 自动注册图标组件
// IconsResolver({
// enabledCollections: ['ep'],
// }),
// // Auto register Element Plus components
// // 自动导入 Element Plus 组件
// ElementPlusResolver(),
// ],
// dts: path.resolve(pathSrc, 'components.d.ts'),
// }),
// dts: path.resolve(pathSrc, 'components.d.ts'),
// }),
// Icons({
// autoInstall: true,
// }),
// Icons({
// autoInstall: true,
// }),
Inspect
(),
],
// 服务器配置
server
:
{
host
:
'0.0.0.0'
,
port
:
Number
(
loadEnv
(
mode
,
process
.
cwd
()).
VITE_APP_PORT
),
strictPort
:
false
,
// 端口被占用直接退出
https
:
false
,
// 默认用http方式
open
:
true
,
// 在开发服务器启动时自动在浏览器中打开应用程序
proxy
:
{
// 代理配置
// 字符串简写写法
// '/foo': '',
// 选项写法
"/lic"
:
{
target
:
'http://192.168.0.8:8090'
// rewrite: (path) => path.replace(/^\/api/, '')
},
// 正则表达式写法
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// },
},
hmr
:
{
overlay
:
true
// 屏蔽服务器报错
}
},
resolve
:
{
// 设置项目文件导入路径
alias
:
{
'@'
:
pathSrc
}
Inspect
(),
],
// 服务器配置
server
:
{
host
:
"0.0.0.0"
,
port
:
Number
(
loadEnv
(
mode
,
process
.
cwd
()).
VITE_APP_PORT
),
strictPort
:
false
,
// 端口被占用直接退出
https
:
false
,
// 默认用http方式
open
:
true
,
// 在开发服务器启动时自动在浏览器中打开应用程序
proxy
:
{
// 代理配置
// 字符串简写写法
// '/foo': '',
// 选项写法
"/lic"
:
{
target
:
"http://192.168.1.27:8090"
,
// rewrite: (path) => path.replace(/^\/api/, '')
},
css
:
{
// css预处理器
preprocessorOptions
:
{
// 引入 var.scss 这样就可以在全局中使用 var.scss中预定义的变量了
// 给导入的路径最后加上 ;
// 正则表达式写法
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// },
},
hmr
:
{
overlay
:
true
,
// 屏蔽服务器报错
},
},
resolve
:
{
// 设置项目文件导入路径
alias
:
{
"@"
:
pathSrc
,
},
},
css
:
{
// css预处理器
preprocessorOptions
:
{
// 引入 var.scss 这样就可以在全局中使用 var.scss中预定义的变量了
// 给导入的路径最后加上 ;
scss
:
{
charset
:
false
,
//防止样式出现警告,中文
additionalData
:
'@import "@/assets/styles/global.scss";'
}
}
scss
:
{
charset
:
false
,
//防止样式出现警告,中文
additionalData
:
'@import "@/assets/styles/global.scss";'
,
},
build
:
{
// 分块打包配置
chunkSizeWarningLimit
:
1500
,
// 分块打包,分解块,将大块分解成更小的块
rollupOptions
:
{
output
:
{
manualChunks
(
id
)
{
if
(
id
.
includes
(
'node_modules'
))
{
return
id
.
toString
().
split
(
'node_modules/'
)[
1
].
split
(
'/'
)[
0
].
toString
();
}
}
}
},
terserOptions
:
{
compress
:
{
drop_console
:
true
,
// 生产环境移除console
drop_debugger
:
true
// 生产环境移除debugger
}
},
},
build
:
{
// 分块打包配置
chunkSizeWarningLimit
:
1500
,
// 分块打包,分解块,将大块分解成更小的块
rollupOptions
:
{
output
:
{
manualChunks
(
id
)
{
if
(
id
.
includes
(
"node_modules"
))
{
return
id
.
toString
()
.
split
(
"node_modules/"
)[
1
]
.
split
(
"/"
)[
0
]
.
toString
();
}
}
})
}
\ No newline at end of file
},
},
},
terserOptions
:
{
compress
:
{
drop_console
:
true
,
// 生产环境移除console
drop_debugger
:
true
,
// 生产环境移除debugger
},
},
},
});
};
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论