{"action":"created","issue":{"url":"https://api.github.com/repos/tkh44/emotion/issues/196","repository_url":"https://api.github.com/repos/tkh44/emotion","labels_url":"https://api.github.com/repos/tkh44/emotion/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/tkh44/emotion/issues/196/comments","events_url":"https://api.github.com/repos/tkh44/emotion/issues/196/events","html_url":"https://github.com/tkh44/emotion/issues/196","id":246334600,"number":196,"title":"injectGlobal","user":{"login":"Geczy","id":1036968,"avatar_url":"https://avatars2.githubusercontent.com/u/1036968?v=4","gravatar_id":"","url":"https://api.github.com/users/Geczy","html_url":"https://github.com/Geczy","followers_url":"https://api.github.com/users/Geczy/followers","following_url":"https://api.github.com/users/Geczy/following{/other_user}","gists_url":"https://api.github.com/users/Geczy/gists{/gist_id}","starred_url":"https://api.github.com/users/Geczy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Geczy/subscriptions","organizations_url":"https://api.github.com/users/Geczy/orgs","repos_url":"https://api.github.com/users/Geczy/repos","events_url":"https://api.github.com/users/Geczy/events{/privacy}","received_events_url":"https://api.github.com/users/Geczy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-28T12:34:18Z","updated_at":"2017-07-28T12:47:01Z","closed_at":null,"body":"- `emotion` version: 6.0.3\r\n- `react` version: 15.6.1\r\n\r\nRelevant code.\r\n\r\n```javascript\r\nimport { injectGlobal } from 'emotion'\r\n\r\ninjectGlobal`\r\n  ...\r\n`\r\n```\r\n\r\nWhat happened:\r\n```\r\nERROR in ./src/components/App.js                \r\nModule build failed: SyntaxError: C:/Users/Matt/Documents/GitHub/frontend/src/components/App.js: NodePath has been removed so is read-only. (This is an error on an internal node. Probably an internal error)\r\n    at File.buildCodeFrameError (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-core\\lib\\transformation\\file\\index.js:427:15)\r\n    at NodePath.buildCodeFrameError (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\index.js:140:26)\r\n    at NodePath._assertUnremoved (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\removal.js:70:16)\r\n    at NodePath.remove (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\removal.js:20:8)\r\n    at replaceGlobalWithCallExpression (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\emotion\\lib\\babel.js:264:23)\r\n    at PluginPass.TaggedTemplateExpression (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\emotion\\lib\\babel.js:91:13)\r\n    at newFn (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\visitors.js:276:21)\r\n    at NodePath._call (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\context.js:76:18)\r\n    at NodePath.call (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\context.js:48:17)\r\n    at NodePath.visit (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\context.js:105:12)\r\n    at TraversalContext.visitQueue (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\context.js:150:16)\r\n    at TraversalContext.visitSingle (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\context.js:108:19)\r\n    at TraversalContext.visit (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\context.js:192:19)\r\n    at Function.traverse.node (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\index.js:114:17)\r\n    at NodePath.visit (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\path\\context.js:115:19)\r\n    at TraversalContext.visitQueue (C:\\Users\\Matt\\Documents\\GitHub\\frontend\\node_modules\\babel-traverse\\lib\\context.js:150:16)\r\n @ ./src/index.js 31:11-36 56:2-59:4 57:4-29\r\n```\r\n\r\nSuggested solution:\r\nAssign injectGlobal to const\r\n\r\nhttps://github.com/tkh44/emotion/issues/186#issuecomment-318632441"},"comment":{"url":"https://api.github.com/repos/tkh44/emotion/issues/comments/318642670","html_url":"https://github.com/tkh44/emotion/issues/196#issuecomment-318642670","issue_url":"https://api.github.com/repos/tkh44/emotion/issues/196","id":318642670,"user":{"login":"mitchellhamilton","id":11481355,"avatar_url":"https://avatars1.githubusercontent.com/u/11481355?v=4","gravatar_id":"","url":"https://api.github.com/users/mitchellhamilton","html_url":"https://github.com/mitchellhamilton","followers_url":"https://api.github.com/users/mitchellhamilton/followers","following_url":"https://api.github.com/users/mitchellhamilton/following{/other_user}","gists_url":"https://api.github.com/users/mitchellhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mitchellhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitchellhamilton/subscriptions","organizations_url":"https://api.github.com/users/mitchellhamilton/orgs","repos_url":"https://api.github.com/users/mitchellhamilton/repos","events_url":"https://api.github.com/users/mitchellhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/mitchellhamilton/received_events","type":"User","site_admin":false},"created_at":"2017-07-28T12:47:01Z","updated_at":"2017-07-28T12:47:01Z","body":"This is caused because of [these lines](https://github.com/tkh44/emotion/blob/master/src/babel.js#L34-L38). The stuff inside the `if` block can be removed and the whole block can be replaced with the contents of the `else` block(`path.replaceWith(t.identifier('undefined'))`)\r\n\r\nThe optimisation I was trying to with that `if` isn't needed since uglify will remove the `undefined` expression anyway.\r\n\r\n@Geczy if you or anyone else wants to do this that would be great."}}
{"actor":{"display_login":"mitchellhamilton"}}