Files
MirageServer/console_web/vite.config.js
Chenyang Gao 6fc96414be 客户端下载页面起了个头
Signed-off-by: Chenyang Gao <gps949@outlook.com>
2023-05-04 18:11:39 +08:00

64 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { resolve } from 'path'
import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
const INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
// https://vitejs.dev/config/
export default defineConfig({
base: '/',
mode: 'production',
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
vue(),
],
build: {
/*
watch:{
},
*/
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
admin: resolve(__dirname, 'admin/index.html'),
login: resolve(__dirname, 'login/index.html'),
downloads: resolve(__dirname, 'downloads/index.html'),
},
output:{
// https://github.com/rollup/rollup/blob/master/src/utils/sanitizeFileName.ts
sanitizeFileName(fileName) {
const match = DRIVE_LETTER_REGEX.exec(fileName);
const driveLetter = match ? match[0] : "";
return (
driveLetter +
fileName.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, "")
);
},
}
},
emptyOutDir: true,
// 指定输出路径,默认'dist'
outDir: '../controller/console_html',
// 指定生成静态资源的存放路径(相对于build.outDir)
assetsDir: 'assets',
// 小于此阈值的导入或引用资源将内联为base64编码设置为0可禁用此项。默认40964kb
assetsInlineLimit: '4096',
// 启用/禁用CSS代码拆分如果禁用整个项目的所有CSS将被提取到一个CSS文件中,默认true
cssCodeSplit: true,
// 构建后是否生成source map文件默认false
sourcemap: false,
// 为true时会生成manifest.json文件用于后端集成
manifest: false
}
})