Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass Systrace and Refresh as globals
Summary: The `Systrace` and `Refresh` dependencies are injected into the `metroRequire` implementation by assigning the values to e.g. `require.Systrace = ...`. The issue with this approach is that some `require` implementations might not support extending the `require` object or doing so results in a degraded performance. An example where this is the case is Hermes where changing the `require` object forces Hermes to opt out of the static require optimization. This diff extends Metro so that the `Systrace` and `Refresh` implementation can either be injected by assigning to `require.Systrace` or by exposing the implementation in the global scope. It further changes the `Systrace` and `Refresh` modules to inject the instances using the global scope instead of extending `require`. Changelog: [Internal][Changed] - Expose Systrace and ReactRefresh as globals instead of extending require. Reviewed By: motiz88 Differential Revision: D25693381 fbshipit-source-id: 254d66d43e7a56d3310cf1a17d5146b8d1307562
- Loading branch information