ae4f46a9cd7eb91a18b2733834b986.blob 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. function checkDCE() {
  3. /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
  4. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function') {
  5. return;
  6. }
  7. if ("development" !== 'production') {
  8. // This branch is unreachable because this function is only called
  9. // in production, but the condition is true only in development.
  10. // Therefore if the branch is still here, dead code elimination wasn't
  11. // properly applied.
  12. // Don't change the message. React DevTools relies on it. Also make sure
  13. // this message doesn't occur elsewhere in this function, or it will cause
  14. // a false positive.
  15. throw new Error('^_^');
  16. }
  17. try {
  18. // Verify that the code above has been dead code eliminated (DCE'd).
  19. __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
  20. } catch (err) {
  21. // DevTools shouldn't crash React, no matter what.
  22. // We should still report in case we break this code.
  23. console.error(err);
  24. }
  25. }
  26. if ("development" === 'production') {
  27. // DCE check should happen before ReactDOM bundle executes so that
  28. // DevTools can report bad minification during injection.
  29. checkDCE();
  30. module.exports = require('./cjs/react-dom.production.min.js');
  31. } else {
  32. module.exports = require('./cjs/react-dom.development.js');
  33. }