Files
dysync/app/vite.config.ts
yuming e6c5587637 feat: Modal 小屏滚动 + 数据看板视频播放 + Docker Alpine 化
- 数据看板作者视频播放接口从 /api/video/stream 改为 /api/Video/play(后端只有 Play action,之前笔误导致 404)
- 全局 Modal 小屏适配:body max-height + 自定义 10px 深色滚动条,兼容 full-modal 和登录页 login-modal
- Docker 镜像换 Alpine + 内置 ffmpeg,避开 Ubuntu apt 网络问题
- 新增 .dockerignore 排除 node_modules / logs / videos / db 等构建噪音
- 移除已废弃的 DyQrCodeService(旧扫码登录)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-03 18:03:57 +08:00

107 lines
3.2 KiB
TypeScript
Raw Permalink 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 { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import { AntdvLessPlugin, AntdvModifyVars } from 'stepin/lib/style/plugins';
import viteCompression from 'vite-plugin-compression';
const timestamp = new Date().getTime();
const prodRollupOptions = {
output: {
chunkFileNames: (chunk) => {
return 'assets/' + chunk.name + '.[hash]' + '.' + timestamp + '.js';
},
assetFileNames: (asset) => {
const name = asset.name;
if (name && (name.endsWith('.css') || name.endsWith('.js'))) {
const names = name.split('.');
const extname = names.splice(names.length - 1, 1)[0];
return `assets/${names.join('.')}.[hash].${timestamp}.${extname}`;
}
return 'assets/' + asset.name;
},
},
};
// vite 配置
// net stop winnat
// net start winnat
export default ({ command, mode }) => {
// 获取环境变量
const env = loadEnv(mode, process.cwd());
return defineConfig({
server: {
host: "0.0.0.0",
cors: true,
port: 8001,
open: false, //自动打开
watch: {
usePolling: true, // 绕过 fsevents 架构不兼容问题(arm64 Mac)
},
proxy: {
'/api': {
target: env.VITE_API_URL,
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\//, ''),
},
},
hmr: true,
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment',
},
build: {
sourcemap: false,
chunkSizeWarningLimit: 2048,
rollupOptions: mode === 'production' ? prodRollupOptions : {},
},
plugins: [
vue({
template: {
transformAssetUrls: {
img: ['src'],
'a-avatar': ['src'],
'stepin-view': ['logo-src', 'presetThemeList'],
'a-card': ['cover'],
},
},
}),
Components({
resolvers: [AntDesignVueResolver({ importStyle: mode === 'development' ? false : 'less' })],
}),
// viteCompression({
// verbose: true, // 是否在控制台中输出压缩结果
// disable: false,
// threshold: 10240, // 如果体积大于阈值,将被压缩,单位为b,体积过小时请不要压缩,以免适得其反
// algorithm: 'gzip', // 压缩算法,可选['gzip',' brotliccompress ','deflate ','deflateRaw']
// ext: '.gz',
// deleteOriginFile: true // 源文件压缩后是否删除(我为了看压缩后的效果,先选择了true)
// }),
],
css: {
preprocessorOptions: {
less: {
plugins: [AntdvLessPlugin],
modifyVars: {
...AntdvModifyVars, // 保留默认变量(可选,按需添加)
'@primary-color': '#722ed1',
// 你的自定义主色调(核心:覆盖默认值)
// 其他需要修改的变量
// '@link-color': '#722ed1',
},
javascriptEnabled: true,
},
},
},
// base: env.VITE_BASE_URL,
});
};