diff --git a/CLAUDE.md b/CLAUDE.md index dbc264ce..893b0cca 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,6 +58,7 @@ - **开发工具**: MSW (Mock Service Worker) 用于 API mocking - **虚拟化**: @tanstack/react-virtual 3.13.12(性能优化) - **其他**: Draft.js(富文本编辑)、React Markdown、React Quill +- Use HeroUI v3 documentation from https://v3.heroui.com/llms.txt **后端** - Flask + SQLAlchemy ORM diff --git a/tailwind.config.js b/tailwind.config.js index 24370cba..0240e56d 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,18 +1,34 @@ /** @type {import('tailwindcss').Config} */ const { heroui } = require("@heroui/react"); +const path = require("path"); module.exports = { - content: [ - // React 组件(排除 node_modules) - "./src/**/*.{js,jsx,ts,tsx}", - "./public/index.html", + content: { + relative: true, + files: [ + // 只扫描项目源码(不包含 node_modules) + "./src/**/*.{js,jsx,ts,tsx}", + "./public/index.html", + + // Hero UI 必需的文件(精确路径) + "./node_modules/@heroui/theme/dist/**/*.{js,mjs}", + "./node_modules/@heroui/react/dist/**/*.{js,mjs}", + ], + // 明确排除 node_modules 的其他部分 + transform: { + // 排除 node_modules 中非 heroui 的文件 + DEFAULT: (content, { path: filePath }) => { + // 如果是 node_modules 中的文件,但不是 @heroui,则跳过 + if (filePath.includes('node_modules') && !filePath.includes('@heroui')) { + return ''; + } + return content; + }, + }, + }, + + darkMode: "class", // 支持深色模式 - // Hero UI 组件(只扫描必要的路径) - "./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}", - "./node_modules/@heroui/react/dist/**/*.{js,ts,jsx,tsx}", - ], - // 添加 JIT 模式优化 - mode: 'jit', theme: { extend: { // Brainwave 自定义颜色 @@ -41,15 +57,18 @@ module.exports = { }, }, }, - darkMode: "class", // 支持深色模式(class 或 media) + plugins: [heroui()], // 性能优化 safelist: [ - // Hero UI 动态类名(避免被 purge) + // Hero UI 动态类名 'bg-gradient-to-br', 'from-blue-500', 'to-purple-500', 'backdrop-blur-xl', ], + + // 优化缓存 + cacheLocation: path.resolve(__dirname, 'node_modules/.cache/tailwindcss'), }