function injectInheritsHmrClass(clazz) {
  let parent = clazz;
  let proto = Object.getPrototypeOf(clazz);
  // walk prototypes until we reach HTMLElement
  while (proto && proto !== HTMLElement) {
    parent = proto;
    proto = Object.getPrototypeOf(proto);
  }

  if (proto !== HTMLElement) {
    // not a web component
    return;
  }
  if (parent === WebComponentHmr) {
    // class already inherits WebComponentHmr
    return;
  }
  Object.setPrototypeOf(parent, WebComponentHmr);
}
Injects the WebComponentHmr class into the inheritance chain