{"action":"created","issue":{"url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/14","repository_url":"https://api.github.com/repos/chentsulin/sweetalert-react","labels_url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/14/comments","events_url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/14/events","html_url":"https://github.com/chentsulin/sweetalert-react/issues/14","id":136256686,"number":14,"title":"ReferenceError: window is not defined","user":{"login":"sabliao","id":4286238,"avatar_url":"https://avatars.githubusercontent.com/u/4286238?v=3","gravatar_id":"","url":"https://api.github.com/users/sabliao","html_url":"https://github.com/sabliao","followers_url":"https://api.github.com/users/sabliao/followers","following_url":"https://api.github.com/users/sabliao/following{/other_user}","gists_url":"https://api.github.com/users/sabliao/gists{/gist_id}","starred_url":"https://api.github.com/users/sabliao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sabliao/subscriptions","organizations_url":"https://api.github.com/users/sabliao/orgs","repos_url":"https://api.github.com/users/sabliao/repos","events_url":"https://api.github.com/users/sabliao/events{/privacy}","received_events_url":"https://api.github.com/users/sabliao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-25T02:31:34Z","updated_at":"2016-02-25T02:44:25Z","closed_at":null,"body":"When starting webpack to run our reactjs project w/ your sweetalert-react library (to get those nice alerts), we can't get it to work for the same reason why we can't get the original sweetalert library to work:\r\n\r\n```\r\n/vagrant/app/node_modules/sweetalert/lib/modules/utils.js:37\r\n  if (window.console) {\r\n      ^\r\n\r\nReferenceError: window is not defined\r\n    at Object.logStr (/vagrant/app/node_modules/sweetalert/lib/modules/utils.js:37:7)\r\n    at Object.<anonymous> (/vagrant/app/node_modules/sweetalert/lib/sweetalert.js:301:48)\r\n    at Module._compile (module.js:413:34)\r\n    at Module._extensions..js (module.js:422:10)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/vagrant/app/node_modules/babel-core/lib/api/register/node.js:214:7)\r\n    at Module.load (module.js:357:32)\r\n    at Function.Module._load (module.js:314:12)\r\n    at Module.require (module.js:367:17)\r\n    at require (internal/module.js:16:19)\r\n    at Object.<anonymous> (/vagrant/app/node_modules/sweetalert-react/lib/SweetAlert.js:17:19)\r\n```\r\n\r\n\r\nwindow is called in the original sweetalert file, and calling an import of the sweetalert-react library calls an import on 'sweetalert', which fails the start of the webpack build. How were you able to get past this issue?"},"comment":{"url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/comments/188573697","html_url":"https://github.com/chentsulin/sweetalert-react/issues/14#issuecomment-188573697","issue_url":"https://api.github.com/repos/chentsulin/sweetalert-react/issues/14","id":188573697,"user":{"login":"chentsulin","id":3382565,"avatar_url":"https://avatars.githubusercontent.com/u/3382565?v=3","gravatar_id":"","url":"https://api.github.com/users/chentsulin","html_url":"https://github.com/chentsulin","followers_url":"https://api.github.com/users/chentsulin/followers","following_url":"https://api.github.com/users/chentsulin/following{/other_user}","gists_url":"https://api.github.com/users/chentsulin/gists{/gist_id}","starred_url":"https://api.github.com/users/chentsulin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chentsulin/subscriptions","organizations_url":"https://api.github.com/users/chentsulin/orgs","repos_url":"https://api.github.com/users/chentsulin/repos","events_url":"https://api.github.com/users/chentsulin/events{/privacy}","received_events_url":"https://api.github.com/users/chentsulin/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T02:44:25Z","updated_at":"2016-02-25T02:44:25Z","body":"`window` should be defined in browser. Are you using sweetalert in server rendering?\r\nAt this moment, it will not work in server rendering. Need some of refactoring there: https://github.com/t4t5/sweetalert/blob/master/dev/sweetalert.es6.js#L310"}}