You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Remix.js中Tailwind插件tailwind-scrollbar-hide无法生效求助

问题排查与解决方案

核心原因:Tailwind配置结构错误

你的Tailwind配置文件中**plugins数组被错误放置在theme对象内部**,违反了Tailwind的配置规范,导致插件无法被框架正确识别加载,自然不会生成对应CSS样式。

修正后的配置文件

将plugins移至与theme同级的位置:

import type { Config } from "tailwindcss";

export default {
  content: ["./app/**/*.{ts,tsx,jsx,js}"],
  theme: {
    extend: {
      fontFamily: {
        staat: ["Staatliches", "Inter"],
      },
      width: {
        "right-col": `calc(100% - 75% - 48px - 8px)`,
      },
      height: {
        "main-area": `calc(100vh - 48px)`,
      },
    },
  },
  plugins: [require("tailwind-scrollbar-hide")], // 移至theme外部,与theme同级
} satisfies Config;

额外排查步骤

  • 确认插件依赖已正确安装:执行npm install tailwind-scrollbar-hide(或对应yarn/pnpm命令),检查package.json中是否存在该依赖。
  • 重启本地开发服务器:配置变更后需重启Tailwind编译进程,确保新配置生效。
  • 验证元素滚动状态:scrollbar-hide仅在元素出现滚动条时生效,确认目标元素内容高度超过容器高度,且overflow-auto已正确触发滚动行为。
  • 检查content匹配范围:确保content配置路径覆盖了使用scrollbar-hide类名的组件文件,若组件在app目录外需调整路径规则。

内容的提问来源于stack exchange,提问作者Renato N_

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 09:20:13