refactor: repartition server-side and client-side code

This commit is contained in:
LIlGG
2025-10-11 18:26:07 +08:00
parent 7acc4949fb
commit e9b573a276
309 changed files with 631 additions and 962 deletions

View File

@@ -43,6 +43,7 @@ export default defineConfig((config) => {
UnoCSS(),
tsconfigPaths(),
chrome129IssuePlugin(),
excludeUploadsPlugin(),
],
css: {
preprocessorOptions: {
@@ -77,3 +78,25 @@ function chrome129IssuePlugin() {
},
};
}
function excludeUploadsPlugin() {
return {
name: 'exclude-uploads',
apply: 'build' as const,
enforce: 'post' as const,
async closeBundle() {
const fs = await import('fs');
const path = await import('path');
const uploadsPath = path.resolve(process.cwd(), 'build/client/uploads');
if (fs.existsSync(uploadsPath)) {
try {
fs.rmSync(uploadsPath, { recursive: true, force: true });
console.log('✓ 已从构建产物中排除 uploads 目录');
} catch (error) {
console.warn('⚠ 删除 uploads 目录时出错:', error);
}
}
},
};
}