Why it is necessary to determine whether exports.nodeType is empty when making node environment compatibility in the JS library.

Source code information is as follows:

 if (typeof exports != "undefined" && !exports.nodeType) {
if (typeof module != "undefined" && !module.nodeType && module.exports) {
  exports = module.exports = _;
}
exports._ = _;
  } else {
root._ = _;
  }
  

I don"t quite understand why we need to judge whether exports.nodeType and module.nodeType are empty here. The attribute nodeType should be used to determine whether it is a dom element. Can we determine whether the dom element is related to the node environment? Ask the Great God for advice


may be to prevent this situation

<div id="exports"></div>
<div id="module"></div>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e391f7-4c8ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e391f7-4c8ab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?