修复退役样式开发态加载

将退役 CSS 源码过滤调整到 Tailwind 转换前执行
新增 Vite 插件顺序回归测试
补充退役方案与开发态白屏排障记录
This commit is contained in:
2026-07-18 15:12:09 +08:00
parent e9c3dc1120
commit f625fe8e8b
4 changed files with 34 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
import type { Plugin } from 'vite';
import { describe, expect, it } from 'vitest';
import viteConfig from '../vite.config';
async function resolveRetiredCssPlugin() {
const resolvedConfig =
typeof viteConfig === 'function'
? await viteConfig({ command: 'serve', mode: 'test' })
: viteConfig;
const plugins = (resolvedConfig.plugins ?? []).flat(Infinity) as Plugin[];
return plugins.find(
(plugin) => plugin?.name === 'retired-creation-template-css',
);
}
describe('retired creation template CSS plugin', () => {
it('runs before Tailwind turns source CSS into a Vite JavaScript module', async () => {
const plugin = await resolveRetiredCssPlugin();
expect(plugin).toBeDefined();
expect(plugin?.enforce).toBe('pre');
});
});