stack/configs
Bilal Godil 603e353484 fix(skills): import stack-shared via package boundary, inline JSON in tsdown build
The skills app's route.ts imported stack-shared through a deep relative path
into the package's src/ tree:

  import { skillSitePrompt } from "../../../../packages/stack-shared/src/...";

This bypasses the @stackframe/stack-shared package export (which points at
./dist/) and drags stack-shared's whole source graph into the Next.js
TypeScript compilation. stack-shared uses vitest's in-source-test pattern
(import.meta.vitest?.test(...)) throughout, and its own tsconfig declares
"vitest/importMeta" in types — but apps/skills/tsconfig.json does not, so
compiling stack-shared sources under skills' tsconfig fails with:

  Type error: Property 'vitest' does not exist on type 'ImportMeta'.

Route the import through the package boundary instead (matching the
established repo convention in docs/ and examples/demo/), and add
@stackframe/stack-shared as a workspace dep on apps/skills.

Once the import goes through dist/, a latent build bug surfaces: the
shared tsdown config marks every non-entry import external, including the
JSON import in stack-shared/src/ai/unified-prompts/skill-site-prompt-parts/
docs-index.ts. The verbatim relative path is preserved in both the CJS
(dist/...) and ESM (dist/esm/...) outputs, but dist/esm/ is one directory
deeper than src/, so the path resolves one segment too high
(packages/docs-mintlify/docs.json instead of docs-mintlify/docs.json).
The CJS build only worked by accident because its depth matched src/.
The published package would have been broken regardless — docs-mintlify/
isn't in stack-shared's "files".

Carve out JSON imports in the force-external plugin so they get inlined
into the dist artifacts. docs.json is 7KB; the only JSON import in
stack-shared/src is this one.
2026-05-26 13:22:41 -07:00
..
eslint Upgrade ESLint 2026-02-27 10:58:28 -08:00
tsdown fix(skills): import stack-shared via package boundary, inline JSON in tsdown build 2026-05-26 13:22:41 -07:00