{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/875","labels_url":"https://api.github.com/repos/webpack/webpack/issues/875/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/875/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/875/events","html_url":"https://github.com/webpack/webpack/issues/875","id":60734822,"number":875,"title":"Requiring 'browser' packages on the server","user":{"login":"zol","id":81672,"avatar_url":"https://avatars.githubusercontent.com/u/81672?v=3","gravatar_id":"","url":"https://api.github.com/users/zol","html_url":"https://github.com/zol","followers_url":"https://api.github.com/users/zol/followers","following_url":"https://api.github.com/users/zol/following{/other_user}","gists_url":"https://api.github.com/users/zol/gists{/gist_id}","starred_url":"https://api.github.com/users/zol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zol/subscriptions","organizations_url":"https://api.github.com/users/zol/orgs","repos_url":"https://api.github.com/users/zol/repos","events_url":"https://api.github.com/users/zol/events{/privacy}","received_events_url":"https://api.github.com/users/zol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-11T21:42:14Z","updated_at":"2015-03-12T16:08:51Z","closed_at":null,"body":"We're writing isomorphic code for rendering views on the server. We're using webpack to build the client off of the same codebase used to render on the server. To prevent `require` from throwing exceptions on the server when loading modules designed for the browser, we're finding ourselves writing code like:\r\n\r\n``` js\r\nvar PictureFill;\r\nvar FastClick;\r\n\r\ntry {\r\n  PictureFill = require('picturefill');\r\n  FastClick = require('fastclick');\r\n} catch (e) {\r\n  if (! e instanceof ReferenceError)\r\n    throw e;\r\n}\r\n```\r\n\r\nIs there a more idiomatic approach we should be using? (i.e what do others do?)\r\n\r\nCross posted with no love from the npm issue tracker [here](https://github.com/npm/npm/issues/7545)\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/78512143","html_url":"https://github.com/webpack/webpack/issues/875#issuecomment-78512143","issue_url":"https://api.github.com/repos/webpack/webpack/issues/875","id":78512143,"user":{"login":"zol","id":81672,"avatar_url":"https://avatars.githubusercontent.com/u/81672?v=3","gravatar_id":"","url":"https://api.github.com/users/zol","html_url":"https://github.com/zol","followers_url":"https://api.github.com/users/zol/followers","following_url":"https://api.github.com/users/zol/following{/other_user}","gists_url":"https://api.github.com/users/zol/gists{/gist_id}","starred_url":"https://api.github.com/users/zol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zol/subscriptions","organizations_url":"https://api.github.com/users/zol/orgs","repos_url":"https://api.github.com/users/zol/repos","events_url":"https://api.github.com/users/zol/events{/privacy}","received_events_url":"https://api.github.com/users/zol/received_events","type":"User","site_admin":false},"created_at":"2015-03-12T16:08:51Z","updated_at":"2015-03-12T16:08:51Z","body":"Thanks @troutowicz and @zxcabs . These answer my question."}}