f625fe8e8b
将退役 CSS 源码过滤调整到 Tailwind 转换前执行 新增 Vite 插件顺序回归测试 补充退役方案与开发态白屏排障记录
25 lines
771 B
TypeScript
25 lines
771 B
TypeScript
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');
|
|
});
|
|
});
|