Skip to content

fix: include source files in published package for IDE navigation#141

Open
amilz wants to merge 1 commit intosolana-program:mainfrom
amilz:fix/include-source-for-ide-navigation
Open

fix: include source files in published package for IDE navigation#141
amilz wants to merge 1 commit intosolana-program:mainfrom
amilz:fix/include-source-for-ide-navigation

Conversation

@amilz
Copy link
Contributor

@amilz amilz commented Mar 14, 2026

Problem

"Go to Definition" (Cmd+Click / F12) on any import from this package takes you to .d.ts type declarations instead of actual source code.

Why

  • declarationMap: true is set in tsconfig ✅
  • .d.ts.map files reference source paths like ../../src/index.ts
  • Source files included in published npm package ❌ — files only includes ./dist/src and ./dist/types

Declaration maps point to ../../src/ but that path doesn't exist in node_modules. IDE can't follow the map, falls back to .d.ts.

Fix

Add "./src/" to the files array in clients/js/package.json. No build, tsconfig, or code changes.

Size impact

  • npm install: small increase (source files only)
  • App bundle size: zero impact — bundlers resolve imports to compiled JS in dist/ via exports/main/module

Context

Same fix applied to @solana/kit (anza-xyz/kit#1468) and @solana/kit-plugins.

Declaration maps reference `../../src/` but source files were excluded
from the npm package. Adding `"./src/"` to the files field enables IDE
"Go to Definition" to navigate to actual TypeScript source instead of
.d.ts type declarations. Zero impact on app bundle size — bundlers
resolve imports via `exports`/`main`/`module` to compiled JS in dist/.
@amilz amilz force-pushed the fix/include-source-for-ide-navigation branch from 0f67deb to d84a48d Compare March 14, 2026 14:13
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.

1 participant