update vite

This commit is contained in:
lutinglt
2025-06-28 19:45:10 +08:00
parent df6eb8fef8
commit b4a0c93221
2 changed files with 2 additions and 4 deletions

View File

@@ -17,16 +17,15 @@ const suffix = ".css.tsx";
export function themeInput( export function themeInput(
outDir: string, outDir: string,
themeDir: string, themeDir: string,
devTheme: string,
mode: string mode: string
): { [key: string]: string } { ): { [key: string]: string } {
const hash = crypto.randomBytes(6).toString("hex"); const hash = crypto.randomBytes(6).toString("hex");
const tmpDir = `${outDir}/tmp-${hash}`; // 输出目录下的临时目录 const tmpDir = `${outDir}/tmp-${hash}`; // 输出目录下的临时目录
fs.mkdirSync(tmpDir, { recursive: true }); fs.mkdirSync(tmpDir, { recursive: true });
const input: { [key: string]: string } = {}; const input: { [key: string]: string } = {};
const themeEntries = fs.readdirSync(themeDir, { withFileTypes: true }); const themeEntries = fs.readdirSync(themeDir, { withFileTypes: true });
const devTheme = process.env.DEV_THEME || "dark"; // 开发模式仅打包单个颜色主题
for (const entry of themeEntries) { for (const entry of themeEntries) {
// 目录下所有的 css.ts 文件都作为主题入口 // 目录下所有的 css.ts 文件都作为主题入口

View File

@@ -13,7 +13,6 @@ dotenv.config({ quiet: true });
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
const devTheme = process.env.DEV_THEME || "dark"; // 开发模式仅打包单个颜色主题
const outDir = "dist"; // 输出目录 const outDir = "dist"; // 输出目录
const themesDir = "themes"; // 颜色主题目录 const themesDir = "themes"; // 颜色主题目录
@@ -54,7 +53,7 @@ export default defineConfig(({ mode }) => {
cssCodeSplit: true, cssCodeSplit: true,
outDir: outDir, outDir: outDir,
rollupOptions: { rollupOptions: {
input: themeInput(outDir, themesDir, devTheme, mode), input: themeInput(outDir, themesDir, mode),
output: { output: {
assetFileNames: "[name].[ext]", assetFileNames: "[name].[ext]",
}, },