vercel / vercel/ncc

NCC consumes too much memory, can't be used with github pipelines

Open
#784 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm using this command: ncc -m -s src/index.js to compile a large project in a single javascript bundle. However, it doesn't work in github pipelines since their containers are limited to 2 GB of ram causing a "memory heap" error during compilation.

I've tested locally by using this command: /usr/bin/time --format "%M" ncc -m -s src/index.js

And this is the result:

34630kB  env/dist/apps/manage-panel/bundle/index.js
90543kB  [146603ms] - ncc 0.31.1
4710052

4710052 -> It means that ncc consumes 4.7GB of ram to compile.

To reduce this amount I have to:

  1. disable the cache (-500Mb)
  2. disable the minification
  3. disable the sourcemap

doing so, the memory consumed is 1.5GB (which is fine for github

By the way, despite cache that should be disabled in pipelines, minification and sourcemap together are consume way too much.
Is there a way to improve this?

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

No source file, test, or entry point is identified in the issue. Start by reproducing ncc -m -s src/index.js with a similarly large project and measure peak memory under the reported conditions. Done means minification and sourcemaps can be used without exceeding a 2 GB GitHub Actions container.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.