feat(branding): migrate hardcoded @brand/logo.png to SVG-aware alias
The four shared layout/login components (Login, LoginDemo,
AppSidebar, MobileDrawer) hardcoded `<img src="@brand/logo.png">`,
which means an SVG-only brand kit (like cfaun's) fails the build
with "Could not load @brand/logo.png".
Switch the four to `<img src="@brand-app-logo">` — the alias registered
via brandAppLogoAliasEntry() (already used by events module) resolves
to whichever of logo.{svg,png} exists in BRAND_DIR (SVG preferred),
with per-app overrides under BRAND_DIR/icons/<app>/.
Also register brandAppLogoAliasEntry in the 8 vite configs that
didn't have it (only events did before), converting their alias maps
to array form so the regex-based logo entry doesn't get shadowed by
the bare-string `@brand` and `@` aliases.
Verified:
- AIO default brand (PNG-only): builds, ships logo-<hash>.png — no regression.
- cfaun brand (SVG-only): builds, ships logo-<hash>.svg — previous
ENOENT on logo.png gone.
Unblocks cfaun deploy with an SVG-only brand kit (no manual
rasterization needed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
80b8219494
commit
5700ac1d1a
12 changed files with 75 additions and 51 deletions
|
|
@ -5,7 +5,7 @@ import { defineConfig, type Plugin } from 'vite'
|
|||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer'
|
||||
import { visualizer } from 'rollup-plugin-visualizer'
|
||||
import { brand, brandAlias, brandAssetsPlugin } from './vite-branding'
|
||||
import { brand, brandAlias, brandAppLogoAliasEntry, brandAssetsPlugin } from './vite-branding'
|
||||
|
||||
function marketHtmlPlugin(): Plugin {
|
||||
return {
|
||||
|
|
@ -103,12 +103,15 @@ export default defineConfig(({ mode }) => ({
|
|||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
...brandAlias,
|
||||
// Array form so the per-standalone logo regex (matches `@brand-app-logo`
|
||||
// with optional `?url` query) doesn't get shadowed by the bare aliases.
|
||||
alias: [
|
||||
brandAppLogoAliasEntry('market'),
|
||||
...Object.entries(brandAlias).map(([find, replacement]) => ({ find, replacement })),
|
||||
// ORDER MATTERS — @/app.config must precede @ (first-match-wins).
|
||||
'@/app.config': fileURLToPath(new URL('./src/market-app/app.config.ts', import.meta.url)),
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
{ find: '@/app.config', replacement: fileURLToPath(new URL('./src/market-app/app.config.ts', import.meta.url)) },
|
||||
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
|
||||
],
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist-market',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue