vercel / vercel/ncc

Structure of `require.cache` is altered with ncc

Open
#243 5 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

Given this index.js:

console.log(require.cache);

Invoke with node index.js:

[Object: null prototype] {
  '/private/tmp/ncc/index.js':
   Module {
     id: '.',
     exports: {},
     parent: null,
     filename: '/private/tmp/ncc/index.js',
     loaded: false,
     children: [],
     paths:
      [ '/private/tmp/ncc/node_modules',
        '/private/tmp/node_modules',
        '/private/node_modules',
        '/node_modules' ] } }

with ncc run index.js:

2kB  index.js
2kB  [641ms]
{ '406': { i: 406, l: false, exports: {} } }

The structure is altered, which cause cache cleaning libs like decache or clear-module failed. Is this intentional or unexpected?

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 with the minimal index.js example and compare require.cache under node index.js and ncc run index.js. Review how the reported decache and clear-module libraries consume the cache structure; done means documenting whether the altered structure is intentional or making the behavior compatible with those cache-cleaning libraries.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.