Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#1195) Summary: We've encountered this as part of a report on the `expo` repo: expo/expo#25965 There, an issue is caused by a dependency using an export alias named `__DEV__`, which the `inlinePlugin` is trying to replace: ```js export { DEV as __DEV__ }; ``` This only occurs in certain cases, since usually, as part of the iOS/Android builds, we would be applying the `inlinePlugin` only after export statements, where this issue may occur, have been transpiled away. However, looking at this issue, I found more cases that would fail with the current implementation of the `inlinePlugin`. This is part of what I added in tests but not an exhaustive list: - Shorthand object methods (`{ __DEV__() {} }`) - Labelled statements (`__DEV__: {};`) - Class methods (`class { __DEV__() {} }`) - Optional property member access (`x?.__DEV__`) All of these issues can be addressed by letting this replacement use `ReferencedIdentifier` as a visitor, rather than just `Identifier`. Pull Request resolved: #1195 Test Plan: - Tests have been added to `inline-plugin-test.js` to reflect the mentioned cases. Reviewed By: huntie Differential Revision: D52909519 Pulled By: motiz88 fbshipit-source-id: 37a6459bc917701fe8474c33ccae41cb484e92f0
- Loading branch information