fix(build): extract STORED_LOGO_SENTINEL to non-server module
Vite/React Router refused to bundle the client because app/routes/app.settings.tsx imported the constant from a .server file and used it inside the route component (not just loader/action), so it could not be tree-shaken out. Move the sentinel to logoCache.constants.ts, re-export from logoCache.server.ts for backwards compatibility, and import the constant from constants in the route while keeping the server-only functions (deleteStoredLogo, storeUploadedLogo) imported from .server (they are only referenced inside the action and get tree-shaken correctly).
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Shared (client + server safe) constants for the logo cache.
|
||||
* Kept in a non-`.server` module so route components can import them
|
||||
* without React Router pulling server-only code into the client bundle.
|
||||
*/
|
||||
export const STORED_LOGO_SENTINEL = "stored://shop-logo";
|
||||
Reference in New Issue
Block a user