main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | function checkDCE() {
|
---|
4 | /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
---|
5 | if (
|
---|
6 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||
|
---|
7 | typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'
|
---|
8 | ) {
|
---|
9 | return;
|
---|
10 | }
|
---|
11 | if (process.env.NODE_ENV !== 'production') {
|
---|
12 | // This branch is unreachable because this function is only called
|
---|
13 | // in production, but the condition is true only in development.
|
---|
14 | // Therefore if the branch is still here, dead code elimination wasn't
|
---|
15 | // properly applied.
|
---|
16 | // Don't change the message. React DevTools relies on it. Also make sure
|
---|
17 | // this message doesn't occur elsewhere in this function, or it will cause
|
---|
18 | // a false positive.
|
---|
19 | throw new Error('^_^');
|
---|
20 | }
|
---|
21 | try {
|
---|
22 | // Verify that the code above has been dead code eliminated (DCE'd).
|
---|
23 | __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
|
---|
24 | } catch (err) {
|
---|
25 | // DevTools shouldn't crash React, no matter what.
|
---|
26 | // We should still report in case we break this code.
|
---|
27 | console.error(err);
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | if (process.env.NODE_ENV === 'production') {
|
---|
32 | // DCE check should happen before ReactDOM bundle executes so that
|
---|
33 | // DevTools can report bad minification during injection.
|
---|
34 | checkDCE();
|
---|
35 | module.exports = require('./cjs/react-dom.profiling.min.js');
|
---|
36 | } else {
|
---|
37 | module.exports = require('./cjs/react-dom.development.js');
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.