'use strict';

var isReactClassish = require('./isReactClassish'),
    isReactElementish = require('./isReactElementish');

function makeExportsHot(m) {
  if (isReactElementish(m.exports)) {
    return false;
  }

  var freshExports = m.exports,
      foundReactClasses = false;

  if (isReactClassish(m.exports)) {
    m.exports = m.makeHot(m.exports, '__MODULE_EXPORTS');
    foundReactClasses = true;
  }

  for (var key in m.exports) {
    if (freshExports.hasOwnProperty(key) &&
        isReactClassish(freshExports[key])) {
      if (Object.getOwnPropertyDescriptor(m.exports, key).writable) {
        m.exports[key] = m.makeHot(freshExports[key], '__MODULE_EXPORTS_' + key);
        foundReactClasses = true;
      } else {
        console.warn("Can't make class " + key + " hot reloadable due to being read-only. You can exclude files or directories (for example, /node_modules/) using 'exclude' option in loader configuration.");
      }
    }
  }

  return foundReactClasses;
}

module.exports = makeExportsHot;

'use strict';

var isReactClassish = require('./isReactClassish'),
    isReactElementish = require('./isReactElementish');

function makeExportsHot(m) {
  if (isReactElementish(m.exports)) {
    return false;
  }

  var freshExports = m.exports,
      foundReactClasses = false;

  if (isReactClassish(m.exports)) {
    m.exports = m.makeHot(m.exports, '__MODULE_EXPORTS');
    foundReactClasses = true;
  }

  for (var key in m.exports) {
    if (Object.prototype.hasOwnProperty.call(freshExports, key) &&
        isReactClassish(freshExports[key])) {
      if (Object.getOwnPropertyDescriptor(m.exports, key).writable) {
        m.exports[key] = m.makeHot(freshExports[key], '__MODULE_EXPORTS_' + key);
        foundReactClasses = true;
      } else {
        console.warn("Can't make class " + key + " hot reloadable due to being read-only. You can exclude files or directories (for example, /node_modules/) using 'exclude' option in loader configuration.");
      }
    }
  }

  return foundReactClasses;
}

module.exports = makeExportsHot;

Fix for modules with null [[Prototype]] chain
Fix for modules with null [[Prototype]] chain

A module created in the following ways:

module.exports = Object.create(null)
module.exports = { __proto__: null }

won't have hasOwnProperty() available on it.

So it’s safer to use Object.prototype.hasOwnProperty.call(myObj, prop)
instead of myObj.hasOwnProperty(prop)
