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

Wrap contents of if-DEV condition in an IIFE #10361

Merged
merged 1 commit into from
Aug 2, 2017

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Aug 2, 2017

This avoids strict mode conflicts for certain browsers wrt functions being defined within an if-block. Also re-added the if-DEV condition for the ReactNative renderer since it was removed for this reason.

Relates to this comment on issue #10294.

cc @hallaathrad

Bundle impact

build/dist

No impact

build/facebook-www/*-dev.js

17a18
> (function() {
1679a1681
> })();

build/packages/*/cjs/*-dev.js

17a18
> (function() {
1679a1681
> })();

build/react-native

__DEV__ && function() { // New line
  // Indented contents of previous bundle
}(); // New line

This avoids strict mode conflicts for certain browsers wrt functions being defined within an if-block.
Also re-added the if-DEV condition for the ReactNative renderer since it was removed for this reason.
@gaearon
Copy link
Collaborator

gaearon commented Aug 2, 2017

Did you check Chromium (old versions)?

@bvaughn
Copy link
Contributor Author

bvaughn commented Aug 2, 2017

Yes. Running the react-virtualized demo site with the previous build of React 16 beta failed for Chromium 41. Rebuilding the bundle (with this change) and running it fixes the failure.

@bvaughn bvaughn merged commit 630afb3 into facebook:master Aug 2, 2017
@bvaughn bvaughn deleted the if-dev-iife branch August 2, 2017 21:24
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.

3 participants