Prevent double application of the transform#176
Merged
Conversation
Codecov Report
|
Owner
|
Maybe I need to read the thread again but I'm still having hard times understanding why someone would compile the code twice. Therefore I'm keeping this open for now, I'll read the thread again. |
Contributor
Author
|
In some cases because of a misconfiguration the plugin may run twice (or possibly more) during one compilation. I'll try to come up with a minimal PoC later this day. |
3ec42bd to
e9a567c
Compare
Closed
Contributor
Author
|
@tleunen I've updated this branch instead of making a new PR to resuse the test. I've used Only new tests added, the previous ones did not break (even with the CJS transform). |
Owner
|
Perfect, lets get this in. Thank you @fatfisz ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were problems described e.g. in #167 wrt. the possible double application stemming from a not-exactly-good configuration. I think we should warn when this may happen and consider this an anti-pattern.
Example of such configuration:
If there's a path
react-native-vector-icons/lib/create-icon-setthen first application of the plugin will transform it to@expo/vector-icons/lib/create-icon-set, and another application will result inreact-native-vector-icons/lib/create-icon-set. This is actually causing trouble for users in some cases.I feel the message could be greatly improved. Any suggestions?
Also this may deserve a section in the README describing the problem, which we could refer to in the message.