Skip to content

Resolve tsconfig paths when loading plugin configs#1762

Merged
webpro merged 2 commits into
webpro-nl:mainfrom
jakeleventhal:fix-serverless-tsconfig-paths
May 27, 2026
Merged

Resolve tsconfig paths when loading plugin configs#1762
webpro merged 2 commits into
webpro-nl:mainfrom
jakeleventhal:fix-serverless-tsconfig-paths

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enable Jiti tsconfig path resolution when loading plugin config files
  • infer path aliases from the workspace TypeScript config, without requiring paths in knip.json
  • extend the Serverless TypeScript plugin fixture with a ~/* path alias import and no Knip path alias config

Verification

  • node --test packages/knip/test/plugins/serverless-framework.test.ts
  • pnpm --dir packages/knip build
  • pnpm --dir packages/knip fmt --check
  • pnpm --dir packages/knip lint
  • node packages/knip/src/cli.ts --directory ../knip-repro-serverless-ts-plugins --no-progress

@pkg-pr-new

pkg-pr-new Bot commented May 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/knip@1762
npm i https://pkg.pr.new/@knip/language-server@1762
npm i https://pkg.pr.new/@knip/mcp@1762

commit: 4a670e1

@jakeleventhal jakeleventhal force-pushed the fix-serverless-tsconfig-paths branch from 3beaf9e to a616e2d Compare May 22, 2026 13:08
@webpro

webpro commented May 27, 2026

Copy link
Copy Markdown
Member

How about starting out with always enabling tsconfigPaths: true in Jiti config?

Does seem to do the job w/o noticeable perf degradation (~0.1% of total runtime in worst case large repo) and is effectively a one-line change. Also has the additional benefit of jiti doing the work to walk up.

Went ahead and committed to your branch. WDYT?

@jakeleventhal

Copy link
Copy Markdown
Contributor Author

LGTM

@webpro

webpro commented May 27, 2026

Copy link
Copy Markdown
Member

OK great, let's roll with it then. Thanks for the PR!

@webpro webpro merged commit 0177c74 into webpro-nl:main May 27, 2026
30 checks passed
@webpro

webpro commented May 31, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.15.0. See Release 6.15.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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