@tacoreai/heroui
v2.8.8
Published
Tacore 内部维护的 HeroUI ESM 版本,目标是给 `esm.sh` / importmap 场景提供一个更稳定的入口。
Readme
@tacoreai/heroui
Tacore 内部维护的 HeroUI ESM 版本,目标是给 esm.sh / importmap 场景提供一个更稳定的入口。
设计目标
- 基于仓库锁定的
@heroui/[email protected]生成单文件 ESM 入口; - 只把
react、react-dom、framer-motion保留为外部依赖,避免 React 多实例; - 把 HeroUI 的大量子包预先打进一个入口里,减少
esm.sh在浏览器侧继续追子依赖时遇到的 404 风险; - 通过包内的 Tailwind v3 + PostCSS 构建 HeroUI 主题样式,并在模块加载时自动注入一次,兼容老项目只引 JS、不单独引 CSS 的用法;
- 兼容
packages/esm本地代理模式,直接通过https://esm.sh/@tacoreai/heroui或本地http://localhost:3008/@tacoreai/heroui使用。
典型 importmap
{
"imports": {
"react": "https://esm.sh/[email protected]",
"react/": "https://esm.sh/[email protected]/",
"react-dom": "https://esm.sh/[email protected]",
"react-dom/": "https://esm.sh/[email protected]/",
"framer-motion": "https://esm.sh/[email protected]?external=react,react-dom&bundle",
"@tacoreai/heroui": "https://esm.sh/@tacoreai/[email protected]?external=react,react-dom,framer-motion&bundle"
}
}使用方式
import { HeroUIProvider, Button, Card, CardBody } from "@tacoreai/heroui";包会在浏览器端自动注入编译后的 HeroUI 样式,不需要额外手动引入 CSS。
重新构建
node packages/esm/heroui/build.mjs构建脚本会同时:
- 用
styles.css + tailwind.config.js + postcss.config.js编译 HeroUI 主题样式; - 把样式内联注入到最终
index.mjs; - 校验最终产物只残留
react/react-dom/framer-motion相关 bare import,避免把新的 HeroUI 子包漏到浏览器运行时。
