Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions backend/installGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,27 @@ function installGlobalHook(window: Object) {

// By now we know that it's envified--but what if it's not minified?
// This can be bad too, as it means DEV code is still there.
const testMinification = renderer.testMinification;

// FIXME: this is fragile!
// We should replace this check with check on a specially passed
// function. This also doesn't detect lack of dead code elimination
// (although this is not a problem since flat bundles).
if (findFiberCode.indexOf('getClosestInstanceFromNode') !== -1) {

// DEV mode check
if (testMinification() === 42) {
// __DEV__ block not removed. Do we warn in console?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaearon Need a little help here. If __DEV__ is not removed do we warn?

}

// dead code elimination check
const testMinificationStr = toString.call(testMinification);
if (testMinification.indexOf('42') === -1) {
// literal 42 present. Warn?
}

if (testMinificationStr.indexOf('testMinification') === -1) {
return 'minified';
} else {
return 'unminified';
}


// We're good.
return 'production';
}
Expand Down