{"action":"created","issue":{"url":"https://api.github.com/repos/atom/electron/issues/1574","labels_url":"https://api.github.com/repos/atom/electron/issues/1574/labels{/name}","comments_url":"https://api.github.com/repos/atom/electron/issues/1574/comments","events_url":"https://api.github.com/repos/atom/electron/issues/1574/events","html_url":"https://github.com/atom/electron/issues/1574","id":73127110,"number":1574,"title":"Respect browser field in package.json?","user":{"login":"matthewwithanm","id":126263,"avatar_url":"https://avatars.githubusercontent.com/u/126263?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewwithanm","html_url":"https://github.com/matthewwithanm","followers_url":"https://api.github.com/users/matthewwithanm/followers","following_url":"https://api.github.com/users/matthewwithanm/following{/other_user}","gists_url":"https://api.github.com/users/matthewwithanm/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewwithanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewwithanm/subscriptions","organizations_url":"https://api.github.com/users/matthewwithanm/orgs","repos_url":"https://api.github.com/users/matthewwithanm/repos","events_url":"https://api.github.com/users/matthewwithanm/events{/privacy}","received_events_url":"https://api.github.com/users/matthewwithanm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/atom/electron/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-04T21:01:55Z","updated_at":"2015-07-08T23:44:55Z","closed_at":"2015-05-05T03:25:38Z","body":"I'm a library maintainer with a package that supports both node and the browser, using a [browser field][1] in `package.json`. Recently, [an issue][2] was raised about the library not working correctly in Electron because, even though the code is being run by Chromium (the client), Electron doesn't respect the browser field when requiring modules.\r\n\r\nI realize that this isn't exactly a normal browser, but it seems to me that it would be logical for the client to use browser versions of modules when they exist. Thoughts?\r\n\r\n[1]: https://github.com/substack/node-browserify#browser-field\r\n[2]: https://github.com/matthewwithanm/httpplease.js/issues/15"},"comment":{"url":"https://api.github.com/repos/atom/electron/issues/comments/119760627","html_url":"https://github.com/atom/electron/issues/1574#issuecomment-119760627","issue_url":"https://api.github.com/repos/atom/electron/issues/1574","id":119760627,"user":{"login":"paulcbetts","id":1396,"avatar_url":"https://avatars.githubusercontent.com/u/1396?v=3","gravatar_id":"","url":"https://api.github.com/users/paulcbetts","html_url":"https://github.com/paulcbetts","followers_url":"https://api.github.com/users/paulcbetts/followers","following_url":"https://api.github.com/users/paulcbetts/following{/other_user}","gists_url":"https://api.github.com/users/paulcbetts/gists{/gist_id}","starred_url":"https://api.github.com/users/paulcbetts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulcbetts/subscriptions","organizations_url":"https://api.github.com/users/paulcbetts/orgs","repos_url":"https://api.github.com/users/paulcbetts/repos","events_url":"https://api.github.com/users/paulcbetts/events{/privacy}","received_events_url":"https://api.github.com/users/paulcbetts/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T23:44:55Z","updated_at":"2015-07-08T23:44:55Z","body":"@yoshuawuyts So for example, many libraries which would be running under 'browser' would (quite reasonably) assume that they are running under node-browserify - in Electron, `require` has node.js Zen Nature (i.e. it's synchronous). Or for example, jQuery sees the presence of `require` and assumes that it shouldn't put itself onto `window.$` when in Electron it probably should. \r\n\r\nIt isn't a class of issues, it's a million one-off bugs that won't be resolved by respecting `browser`. And in fact, libraries that are already Electron-aware will now _break_ because this will be a significant change in behavior. "}}