{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/polyglot.js/issues/35","labels_url":"https://api.github.com/repos/airbnb/polyglot.js/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/polyglot.js/issues/35/comments","events_url":"https://api.github.com/repos/airbnb/polyglot.js/issues/35/events","html_url":"https://github.com/airbnb/polyglot.js/pull/35","id":99149283,"number":35,"title":"Handle no window object with Webpack","user":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-05T08:19:02Z","updated_at":"2015-08-05T08:31:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/airbnb/polyglot.js/pulls/35","html_url":"https://github.com/airbnb/polyglot.js/pull/35","diff_url":"https://github.com/airbnb/polyglot.js/pull/35.diff","patch_url":"https://github.com/airbnb/polyglot.js/pull/35.patch"},"body":"In environments like Webpack there is no `this` to refer to the global object. But you do have global, which is the Node global object.\r\n\r\nI suggest supporting that to ensure logging works. An other fix would be to check if `root` actually exists when logging.\r\n\r\nAt least now it breaks with Webpack, which is too bad :-/"},"comment":{"url":"https://api.github.com/repos/airbnb/polyglot.js/issues/comments/127914351","html_url":"https://github.com/airbnb/polyglot.js/pull/35#issuecomment-127914351","issue_url":"https://api.github.com/repos/airbnb/polyglot.js/issues/35","id":127914351,"user":{"login":"ljharb","id":45469,"avatar_url":"https://avatars.githubusercontent.com/u/45469?v=3","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T08:31:30Z","updated_at":"2015-08-05T08:31:30Z","body":"Sadly the only truly reliable way to get the global object in all environments is `Function('return this')()`, which breaks CSP - but if you know you're not in strict mode, you could do `(function () { return this; }())` as well."}}