- 添加开发、生产和预发布环境配置文件 - 配置不同环境的API接口地址和压缩选项 - 创建401和404错误页面组件 - 添加生产相关的操作对话框和历史记录组件 - 集成仓库代理功能API - 添加应用状态管理模块 - 创建基础样式定义文件
29 lines
719 B
JavaScript
29 lines
719 B
JavaScript
import compression from 'vite-plugin-compression'
|
|
|
|
export default function createCompression(env) {
|
|
const { VITE_BUILD_COMPRESS } = env
|
|
const plugin = []
|
|
if (VITE_BUILD_COMPRESS) {
|
|
const compressList = VITE_BUILD_COMPRESS.split(',')
|
|
if (compressList.includes('gzip')) {
|
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
|
plugin.push(
|
|
compression({
|
|
ext: '.gz',
|
|
deleteOriginFile: false
|
|
})
|
|
)
|
|
}
|
|
if (compressList.includes('brotli')) {
|
|
plugin.push(
|
|
compression({
|
|
ext: '.br',
|
|
algorithm: 'brotliCompress',
|
|
deleteOriginFile: false
|
|
})
|
|
)
|
|
}
|
|
}
|
|
return plugin
|
|
}
|