{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/3763","labels_url":"https://api.github.com/repos/facebook/react-native/issues/3763/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/3763/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/3763/events","html_url":"https://github.com/facebook/react-native/issues/3763","id":113979960,"number":3763,"title":"SyntaxError: Unexpected token '}'. Expected a statement as the body of a for loop.","user":{"login":"oney","id":4091190,"avatar_url":"https://avatars.githubusercontent.com/u/4091190?v=3","gravatar_id":"","url":"https://api.github.com/users/oney","html_url":"https://github.com/oney","followers_url":"https://api.github.com/users/oney/followers","following_url":"https://api.github.com/users/oney/following{/other_user}","gists_url":"https://api.github.com/users/oney/gists{/gist_id}","starred_url":"https://api.github.com/users/oney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oney/subscriptions","organizations_url":"https://api.github.com/users/oney/orgs","repos_url":"https://api.github.com/users/oney/repos","events_url":"https://api.github.com/users/oney/events{/privacy}","received_events_url":"https://api.github.com/users/oney/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/Regression","name":"Regression","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-29T04:57:51Z","updated_at":"2015-10-29T06:54:06Z","closed_at":null,"body":"I run `react-native init TestProject` to create a project, then I run the app with iOS and it works fine.\r\nI add `socket.io-client` in my dependencies, and run `npm install`.\r\n```json\r\n\"dependencies\": {\r\n  \"react-native\": \"^0.13.2\",\r\n  \"socket.io-client\": \"^1.3.7\"\r\n}\r\n```\r\nAnd add \r\n```javascript\r\nwindow.navigator.userAgent = \"react-native\";\r\nvar io = require('socket.io-client/socket.io');\r\n\r\nvar TestProject = React.createClass({\r\n...\r\n```\r\nI got\r\n```\r\nSyntaxError: Unexpected token '}'. Expected a statement as the body of a for loop.\r\n```\r\n![image](http://i.imgur.com/UZZvfT9.png)\r\nI use socket.io before, and it works. However, every my React Native project that uses socket.io is broken now. So strange...\r\nLine 60582 of `http://localhost:8081/index.ios.bundle?platform=ios&dev=true` is\r\n```javascript\r\nfor(length = members.length;property = members[--length];hasProperty.call(object,property) && callback(property))}}else \r\n```\r\n\r\nIt seems that many `;` symbol is gone in my js bundle file."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/152097799","html_url":"https://github.com/facebook/react-native/issues/3763#issuecomment-152097799","issue_url":"https://api.github.com/repos/facebook/react-native/issues/3763","id":152097799,"user":{"login":"ntuckerxx","id":80917,"avatar_url":"https://avatars.githubusercontent.com/u/80917?v=3","gravatar_id":"","url":"https://api.github.com/users/ntuckerxx","html_url":"https://github.com/ntuckerxx","followers_url":"https://api.github.com/users/ntuckerxx/followers","following_url":"https://api.github.com/users/ntuckerxx/following{/other_user}","gists_url":"https://api.github.com/users/ntuckerxx/gists{/gist_id}","starred_url":"https://api.github.com/users/ntuckerxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntuckerxx/subscriptions","organizations_url":"https://api.github.com/users/ntuckerxx/orgs","repos_url":"https://api.github.com/users/ntuckerxx/repos","events_url":"https://api.github.com/users/ntuckerxx/events{/privacy}","received_events_url":"https://api.github.com/users/ntuckerxx/received_events","type":"User","site_admin":false},"created_at":"2015-10-29T06:54:06Z","updated_at":"2015-10-29T06:54:06Z","body":"I came up with a hacky workaround.  There's this in socket.io.js, line 6395:\r\n\r\n```javascript\r\nfor (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property));\r\n```\r\n\r\nModifying it to include an empty for loop body did the trick.  Looking at the output of the packager, it looks like the transformation caused the semicolons to get stripped from this line and the one immediately following it, and the two following closing braces to get stuck on the same line, resulting in a transformation from:\r\n\r\n```javascript\r\n        for( ... );\r\n    };\r\n}\r\n```\r\n\r\nto:\r\n\r\n```\r\n    for( ... ) }}\r\n```\r\n"}}