Skip to content

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

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#429
amilz wants to merge 1 commit intosolana-program:mainfrom
amilz:fix/include-source-for-ide-navigation

Conversation

@amilz
Copy link

@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/.
Copy link
Member

@mcintyre94 mcintyre94 left a comment

Choose a reason for hiding this comment

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

Thankyou! 🚀

@mcintyre94 mcintyre94 enabled auto-merge (squash) March 16, 2026 10:42
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.

2 participants