A standalone React component library built with Vite + Tailwind v4.
pnpm add @kacker/ui
# or
npm i @kacker/uiIn your app's entry file, import the bundled styles once:
import "@kacker/ui/style.css";The workflow below uses pnpm's global link, which creates a symlink in your
consumer app's node_modules without modifying its package.json. When you
later run pnpm install in the consumer, the registry version is restored
automatically — no cleanup needed before pushing.
# 1. In THIS repo (kacker_ui):
pnpm install
pnpm link --global
# 2. In the consumer app:
pnpm link --global @kacker/ui# In kacker_ui — rebuilds on every save into dist/
pnpm dev
# In the consumer app — start as usual
pnpm devAny save here triggers a rebuild; the consumer's Vite dev server detects the
change in its linked node_modules/@kacker/ui and reloads.
Vite pre-bundles node_modules deps by default, which can blunt HMR for linked
packages. Add this to the consumer's vite.config.ts:
export default defineConfig({
optimizeDeps: {
exclude: ["@kacker/ui"],
},
server: {
watch: {
// follow the symlink so file changes are picked up
followSymlinks: true,
},
},
});# In the consumer app:
pnpm unlink --global @kacker/ui
pnpm install # restores the published version| Script | Purpose |
|---|---|
pnpm dev |
Build in watch mode (for local linking) |
pnpm build |
Production build (ESM + CJS + d.ts + CSS) |
pnpm ver-sync |
Bump patch version in package.json |
dist/ contains:
index.js— ESM bundleindex.cjs— CommonJS bundleindex.d.ts— type declarationsindex.css— bundled styles (consumer imports via@kacker/ui/style.css)