Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only prune when unreachable (not merely unused) and add module ignore option #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rtsao
Copy link
Owner

@rtsao rtsao commented Apr 15, 2020

This changes the behavior of this plugin slightly and adds an option to ignore specific modules (i.e. never prune).

Imports will only be pruned if and only if all of the following conditions are met:

  • Specifiers exist (i.e. not a importing for side effects only)
  • "Unreachable" references to specifiers exist (i.e. not "unused" entirely)

This change means the hardcoded React exception is no longer needed, as scope traversal happens before the JSX transform and thus no references will exist, so it has been deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant