From acea7e699df823f2e65a67bf80f634f196171dab Mon Sep 17 00:00:00 2001 From: WorkBuddy Date: Tue, 15 Sep 2026 17:45:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8D=20postcss?= =?UTF-8?q?=20=E9=85=8D=E7=BD=AE=E8=AF=AF=E5=86=99=E5=AF=BC=E8=87=B4=20Tai?= =?UTF-8?q?lwind=20=E4=BB=8E=E6=9C=AA=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit postcss.config.js 中写入的是 Tailwind 的配置对象(content/theme/plugins), 缺少 PostCSS 插件注册所需的 plugins 字段,导致 PostCSS 从未加载 tailwindcss。 所有 className 上的 Tailwind 工具类一直是无效字符串,页面仅使用浏览器默认样式。 修复为标准写法 plugins: { tailwindcss: {}, autoprefixer: {} }。 验证:构建产物 CSS 由 1.81 kB 增至 24.66 kB,且不再残留未编译的 @tailwind / @apply / @layer 指令。 --- frontend/postcss.config.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js index 2db3056..2e7af2b 100644 --- a/frontend/postcss.config.js +++ b/frontend/postcss.config.js @@ -1,5 +1,6 @@ export default { - content: ['./index.html', './src/**/*.{ts,tsx}'], - theme: { extend: {} }, - plugins: [], + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, }