vercel / vercel/ncc

Support big TypeScript projects

Open
#385 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
9.8k
Forks
326
PR merge metrics
No merged PRs in 30d

Description

In my TypeScript codebase I have a folder structure like this:

src
  module1/index.ts
  	...
  module2/index.ts
	...

My tsconfig.json looks like this:

{
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist"
  }
}

When running ncc src/module1/index.ts -o module, it also builds the dist folder into it, including module2.
The output in ./module1 looks like this:

module1
  dist/...
  module2/...
  module1/...
  index.d.ts
  index.js

What do you think is the most elegant way to fix this?

One possibility would be providing a path to a tsconfig.json file.
In that tsconfig.json file I then could provide "rootDir": "src/module" - that would already help. But still it would be great if dist would not be copied over.

For now, I'm manually cleaning up ./module1 as I don't want to ship that clutter.

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing ncc src/module1/index.ts -o module with the shown src layout and tsconfig.json. Trace how the ncc entry point handles TypeScript project files and output paths. Done means building one module no longer copies dist or sibling module2 content into the output.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.