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
Feature request: Option to remove imports of custom propTypes in current package, and from deep imports #144
Comments
@lencioni What makes you think this plugin can be more efficient at removing dead code than another tool specifically tailored for it? I mean, if a dead code prunner can't remove some code, what enable us, from an architectural point of view, to do it? We definitely want people to have a bundle |
Although the minification of the custom propType code itself, as you linked to, is useful, I would ideally like to remove the import as well in the same way that the I think a JavaScript minifier will not remove the unused import because it doesn't know that the import is free of side-effects. Having a way to opt in related imports in this plugin would be useful. Another thought that occurs to me is that this could perhaps be automatically detected. When removing the propTypes, it could detect any newly unused imports and remove them as well. |
I don't think that it should be the default behavior given the potential side effects you mentioned, at the exception of |
We have some packages that have some custom propTypes defined in modules in that package itself. For example:
These custom propTypes can also be imported by consuming packages via deep imports:
It would be nice to have an option that is similar to
additionalLibraries
that could be used to remove these imports. Perhaps the option could take a regex pattern or glob pattern?The text was updated successfully, but these errors were encountered: