FormidableLabs/trace-deps

Feature: Support tree shaking.

Opened this issue · 0 comments

Background

https://unpkg.com/react@16.13.0/index.js is simply:

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

If we know NODE_ENV (see: #2 ) we could filter to only one of these dependencies to further trace instead of both as currently happens.

Work

Filter out dependency files that aren't used by the intro srcPath file.

  • ESM: Pretty much what webpack does already for package.json:module ESM code.
  • CommonJS: Has correctness challenges at the outset. Research and consider options here.