chore: 打包时将 bg.jpg 也打包进去

This commit is contained in:
unanmed 2025-09-03 17:29:17 +08:00
parent 0d98a6ce57
commit 7c5cd12d0e

View File

@ -1,7 +1,7 @@
import { build, loadConfigFromFile, mergeConfig, UserConfig } from 'vite';
import legacy from '@vitejs/plugin-legacy';
import { resolve } from 'path';
import { copy, emptyDir, ensureDir } from 'fs-extra';
import { copy, emptyDir, ensureDir, pathExists } from 'fs-extra';
import { OutputAsset, OutputChunk, RollupOutput } from 'rollup';
import Fontmin from 'fontmin';
import { readdir, readFile, rmdir, stat, writeFile } from 'fs/promises';
@ -597,6 +597,15 @@ async function buildGame() {
resolve(process.cwd(), 'script/template/启动服务.exe'),
resolve(distDir, '启动服务.exe')
);
const bgPath = 'project/images/bg.jpg';
if (await pathExists(resolve(tempDir, 'client', bgPath))) {
await copy(
resolve(tempDir, 'client', bgPath),
resolve(distDir, bgPath)
);
}
} catch (e) {
logProgress(6, ProgressStatus.Fail);
process.stderr.write(String(e));