vercel / vercel/ncc

Memory leak during build with ncc - conditional properties

Open
#653 2 comments 0 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

We are using ncc for a big project amd while migrating to typescript error with memory leak occured during project building with ncc.
That might be related to settings (maybe?) of ncc, but while returning conditional properties - memory leak is popping up.
Example:
Let's say we return object with many conditional properties:

... 
return {
    ...(conditionalProp1 && {conditionalProp1}),
    ... //etc.
}

Then during building it crashes at actually nothing helps. Have anyone had similar issue?
The "walkaround" solution for it is to create a function which omits all of the empty/falsy properties and then it works normally.

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 an ncc build using the conditional object properties shown in the issue, then compare it with the workaround that removes falsy properties. A complete fix would prevent the build from exhausting memory or crashing for this pattern, but the issue provides no named files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.