Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when using a minified copy of dev React #5083

Merged
merged 1 commit into from
Oct 8, 2015

Conversation

sophiebits
Copy link
Collaborator

Fixes #4842.

@syranide
Copy link
Contributor

syranide commented Oct 8, 2015

Idea; since you actually enable name mangling and optimizations separately, what about checking (function() { 0; }).toString().indexOf('0') !== -1 (or return 0+0 and test for +). In the end it doesn't really matter, just thought I'd bring it up.

@@ -74,6 +74,15 @@ if (__DEV__) {
}
}

function testFn() {}
warning(
(testFn.name || testFn.toString()).indexOf('testFn') !== -1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, that's smart.

@jimfb
Copy link
Contributor

jimfb commented Oct 8, 2015

@syranide Haha, interesting. In theory, a good optimizer would replace (function() { 0+0; }).toString().indexOf('+') !== -1 with true. But I suspect that's an academic discussion, since I can't think of how detecting optimizations adds much value on top of detecting minification.

@syranide
Copy link
Contributor

syranide commented Oct 8, 2015

@jimfb That applies to the original code as well. It would also be an invalid optimization as toString could have been overloaded elsewhere.

@jimfb
Copy link
Contributor

jimfb commented Oct 8, 2015

👍

sophiebits added a commit that referenced this pull request Oct 8, 2015
Warn when using a minified copy of dev React
@sophiebits sophiebits merged commit 3f57470 into facebook:master Oct 8, 2015
@lijunle
Copy link

lijunle commented Nov 17, 2016

Hi, the short URL https://fb.me/react-minification does not redirect to something meaningful now. There is not download page now.

@sophiebits
Copy link
Collaborator Author

I updated the URL to point somewhere more relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants