Files
artcraft/frontend/libs/shared-vite-config.ts
T
BFlat b36e4fd27b Refactor: replace fontawesome icons with lucide icons (#1873)
Removes Font Awesome entirely

### Changes

- All ~1,000 icon call sites now import Lucide components directly from
`lucide-react` (`<PlayIcon className="..." />`); no FA packages, tokens,
or `fa*` identifiers remain anywhere.
- New `@storyteller/icons` lib holds the pieces Lucide doesn't ship:
`DynamicIcon` for runtime-chosen icons (`icon={loading ?
LoaderCircleIcon : SaveIcon}`), 11 brand logos (Discord, TikTok, ...) as
inlined CC BY 4.0 paths, and HD/SD quality badges drawn in Lucide's
stroke style.
- Global `.lucide { display: inline-block; width/height: 1.2em }` rule
in each app stylesheet: keeps icons font-relative like FA (1.2em
compensates Lucide's 24px-viewBox/20px-grid padding) and undoes Tailwind
preflight's `svg { display: block }`. Explicit `w-*`/`size-*` utilities
still win.
- FA-only props migrated: `spin` → `animate-spin`, FA size strings → em
values.
- Dropped `@fortawesome/*` + `@awesome.me` kit deps, both `.npmrc`
files, and
the FA rule in `shared-vite-config.ts` (now externalizes
`lucide-react`).
2026-08-10 02:04:45 +07:00

60 lines
1.4 KiB
TypeScript

/**
* Shared Vite configuration for library builds.
*
* This ensures that:
* 1. React is always externalized (peer dependency)
* 2. @preact/signals-* packages are externalized to prevent duplicate state
* 3. @storyteller/* workspace packages are externalized so libraries don't bundle each other
*
* Without this, stateful modules like signals get bundled multiple times,
* causing state isolation issues in production builds.
*/
/**
* Returns true if the given module ID should be externalized during library builds.
*/
export function isExternal(id: string): boolean {
// Always externalize React
if (
id === 'react' ||
id === 'react-dom' ||
id === 'react/jsx-runtime' ||
id.startsWith('react/') ||
id.startsWith('react-dom/')
) {
return true;
}
// Other react libraries
if (
id === 'react-hot-toast' ||
id === 'react-router-dom' ||
id.startsWith('react-')
) {
return true;
}
// Externalize @preact/signals to prevent duplicate signal state
if (id.startsWith('@preact/signals')) {
return true;
}
// Other important libraries
if (
id === 'konva' ||
id === 'three' ||
id === 'zustand' ||
id === 'wavesurfer.js' ||
id === 'lucide-react'
) {
return true;
}
// Externalize all workspace packages so libraries don't bundle each other
if (id.startsWith('@storyteller/') || id.startsWith('@frontend/')) {
return true;
}
return false;
}