HTTPArchive/custom-metrics

Script injection functionality for React detection

kara opened this issue · 0 comments

kara commented

It's possible to detect React versions if you run the following code before React loads:

__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
  supportsFiber: true,
  inject(renderer) {
    console.log(renderer.version);
  }
}

When running the code through WPT's "inject script" functionality, it works as expected (see examples here and here).

However, it won't work in the normal "custom metrics" workflow because it runs too late. Is it possible to turn script injection back on in the 'inject-dist' directory?