Skip to content

fix(build): add tsconfig paths mapping for datavis submodule#167

Merged
wreiske merged 2 commits intomainfrom
fix/tsconfig-datavis-paths
Apr 8, 2026
Merged

fix(build): add tsconfig paths mapping for datavis submodule#167
wreiske merged 2 commits intomainfrom
fix/tsconfig-datavis-paths

Conversation

@garrity-miepub
Copy link
Copy Markdown
Contributor

The DTS (type declaration) build was failing with TS2307 errors on all datavis/src/* imports in DataVisNITRO.tsx. The ESM/CJS build succeeded because tsup externalizes those imports via /^datavis//, but TypeScript still needs to resolve the types for .d.ts generation.

The root cause: TypeScript resolves datavis/src/* through pnpm's node_modules symlink chain, which can be fragile depending on the pnpm store state and link timing. Adding a paths mapping tells TypeScript to resolve directly to ./packages/datavis/src/*, bypassing the symlink entirely.

Verified with a fresh clone: git clone → pnpm install → pnpm build produces ESM, CJS, and DTS output successfully.

The DTS (type declaration) build was failing with TS2307 errors on all
datavis/src/* imports in DataVisNITRO.tsx. The ESM/CJS build succeeded
because tsup externalizes those imports via /^datavis\//, but TypeScript
still needs to resolve the types for .d.ts generation.

The root cause: TypeScript resolves datavis/src/* through pnpm's
node_modules symlink chain, which can be fragile depending on the
pnpm store state and link timing. Adding a paths mapping tells
TypeScript to resolve directly to ./packages/datavis/src/*, bypassing
the symlink entirely.

Verified with a fresh clone: git clone → pnpm install → pnpm build
produces ESM, CJS, and DTS output successfully.
@garrity-miepub garrity-miepub marked this pull request as ready for review April 8, 2026 01:11
Copilot AI review requested due to automatic review settings April 8, 2026 01:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The DTS build was failing with TS2307 errors on all datavis/src/*
imports in DataVisNITRO.tsx. The ESM/CJS build succeeded because tsup
externalizes those imports via /^datavis\//, but TypeScript still needs
to resolve the types for .d.ts generation.

The fix uses a split tsconfig strategy:

- tsconfig.json (unchanged): used by 'tsc --noEmit' (typecheck) and
  IDE tooling. Does NOT include datavis/src/* paths, so it won't crawl
  into the datavis submodule's full source tree and error on its
  transitive dependencies (react-i18next, @dnd-kit/*, etc.).

- tsconfig.build.json (new): extends tsconfig.json and adds a paths
  mapping for datavis/src/* -> ./packages/datavis/src/*. This lets
  TypeScript resolve the deep submodule imports directly without
  relying on pnpm's symlink chain.

- tsup.config.ts: now sets tsconfig: 'tsconfig.build.json' at the
  root level so DTS generation uses the build-specific config.

Verified with fresh clone: git clone -> pnpm install -> pnpm typecheck
(passes) -> pnpm build (ESM, CJS, DTS all succeed).
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 8, 2026

Deploying ui with  Cloudflare Pages  Cloudflare Pages

Latest commit: e6c578a
Status: ✅  Deploy successful!
Preview URL: https://34e1af71.ui-6d0.pages.dev
Branch Preview URL: https://fix-tsconfig-datavis-paths.ui-6d0.pages.dev

View logs

@wreiske wreiske merged commit f000c7a into main Apr 8, 2026
10 checks passed
@wreiske wreiske deleted the fix/tsconfig-datavis-paths branch April 8, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants