Commit 99c2541
fix(themes): RSC-safe
The Next.js example's `app/layout.tsx` is a Server Component. Importing
`getInitialAppearanceScript` from the package root pulled in the full
client barrel, transitively `react-router`, which exports `useRouteError`
that doesn't exist in the React Server Components build — Turbopack RSC
bailed with "Export useRouteError doesn't exist in target module".
Fix: ship `getInitialAppearanceScript` as a leaf subpath
`@tailor-platform/app-shell/initial-appearance`. The source already has no
React / react-router imports (only `type` imports from `theme-context`
that are erased at compile time), so it's a ~1KB zero-runtime-dep entry —
safe to call from any RSC layout. Added to `vite.config.ts` build entries
and `package.json` exports. The top-level export remains for non-RSC
consumers; docs and the Next.js example use the leaf subpath.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>initial-appearance subpath for getInitialAppearanceScript
1 parent 4d4e84d commit 99c2541
4 files changed
Lines changed: 10 additions & 3 deletions
File tree
- docs/api
- examples/nextjs-app/src/app
- packages/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
0 commit comments