feat: Support TailwindCSS V3

Signed-off-by: Apple\Apple <zeraturing@foxmail.com>
This commit is contained in:
Apple\Apple
2025-05-06 00:14:18 +08:00
parent 1c67dd3c31
commit 74572ab2ee
5 changed files with 162 additions and 319 deletions

View File

@@ -20,6 +20,26 @@ export default defineConfig({
},
},
react(),
{
name: 'semi-css-layer',
transformIndexHtml(html) {
// Add layer to Semi CSS by prepending style tag
return html.replace(
/<\/head>/,
`<style>@layer tailwind-base,semi,tailwind-components,tailwind-utils;</style></head>`
);
},
transform(code, id) {
if (id.includes('@douyinfe/semi-ui') && id.endsWith('.css')) {
// Wrap Semi CSS in a layer
return {
code: `@layer semi { ${code} }`,
map: null
};
}
return null;
}
}
],
optimizeDeps: {
force: true,