Skip to content

fix: support TypeScript project references - #1337

Open
JJordan0C wants to merge 3 commits into
vercel:mainfrom
JJordan0C:fix/typescript-project-references
Open

fix: support TypeScript project references#1337
JJordan0C wants to merge 3 commits into
vercel:mainfrom
JJordan0C:fix/typescript-project-references

Conversation

@JJordan0C

@JJordan0C JJordan0C commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • allow ncc to bundle TypeScript composite projects that import referenced sibling sources
  • keep composite build artifacts out of ncc's single-bundle compilation
  • add a regression fixture matching the app/lib workspace reported in the issue
  • run the regression through the standard unit golden-output runner in normal and coverage modes

Root cause

When composite is enabled, TypeScript implicitly scopes rootDir to the directory containing the project tsconfig. ncc compiles the entry point and its imported sources as one webpack compilation, so a referenced sibling project was rejected with TS6059.

ncc already controls emit-related compiler options for its internal compilation. Disabling composite there preserves the single-bundle model while leaving the user's tsconfig unchanged.

Tests

  • pnpm build-test-binary
  • pnpm build
  • pnpm test (119 passed)
  • pnpm test-coverage
  • pnpm test test/unit.test.js --runInBand --testNamePattern=ts-project-references
  • pnpm test-coverage test/unit.test.js --testNamePattern=ts-project-references

Fixes #1212

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.

Build fails with composite: true in tsconfig.json

2 participants