which-module.js 321 B

12345678910
  1. export default function whichModule(exported) {
  2. if (typeof require === 'undefined')
  3. return null;
  4. for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
  5. mod = require.cache[files[i]];
  6. if (mod.exports === exported)
  7. return mod;
  8. }
  9. return null;
  10. }