31 lines
959 B
JavaScript
31 lines
959 B
JavaScript
import { defineConfig } from 'vite'
|
|
import uni from '@dcloudio/vite-plugin-uni'
|
|
import viteCompression from 'vite-plugin-compression'
|
|
|
|
export default defineConfig({
|
|
define: {__VUE_I18N_FULL_INSTALL__: true, __VUE_I18N_LEGACY_API__: true, __INTLIFY_PROD_DEVTOOLS__: false},
|
|
plugins: [
|
|
uni(),
|
|
viteCompression({
|
|
verbose: true, // 是否在控制台输出压缩结果
|
|
disable: false, // 是否禁用 gzip 压缩
|
|
threshold: 10240, // 压缩文件的大小阈值(以字节为单位)
|
|
algorithm: 'gzip', // 压缩算法
|
|
ext: '.gz', // 压缩文件的后缀名
|
|
deleteOriginFile: false, // 是否删除原文件
|
|
// 包含/排除规则,使用 minimatch 模式
|
|
include: /\.(js|css|json|html|svg)$/,
|
|
exclude: /node_modules/
|
|
})
|
|
],
|
|
server: {
|
|
port: 8088,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080', // 目标服务
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api/, ''),
|
|
}
|
|
}
|
|
}
|
|
}) |