Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Feature: Support tree shaking. #11

Open
2 tasks
ryan-roemer opened this issue Mar 2, 2020 · 0 comments
Open
2 tasks

Feature: Support tree shaking. #11

ryan-roemer opened this issue Mar 2, 2020 · 0 comments
Labels
feature New feature or request

Comments

@ryan-roemer
Copy link
Member

Background

https://unpkg.com/[email protected]/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.
@ryan-roemer ryan-roemer added the feature New feature or request label Mar 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant