{"action":"created","issue":{"url":"https://api.github.com/repos/marijnh/browserkeymap/issues/4","repository_url":"https://api.github.com/repos/marijnh/browserkeymap","labels_url":"https://api.github.com/repos/marijnh/browserkeymap/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/marijnh/browserkeymap/issues/4/comments","events_url":"https://api.github.com/repos/marijnh/browserkeymap/issues/4/events","html_url":"https://github.com/marijnh/browserkeymap/issues/4","id":195256663,"number":4,"title":"Publish ES6 compatible module shape","user":{"login":"bradleyayers","id":105820,"avatar_url":"https://avatars.githubusercontent.com/u/105820?v=3","gravatar_id":"","url":"https://api.github.com/users/bradleyayers","html_url":"https://github.com/bradleyayers","followers_url":"https://api.github.com/users/bradleyayers/followers","following_url":"https://api.github.com/users/bradleyayers/following{/other_user}","gists_url":"https://api.github.com/users/bradleyayers/gists{/gist_id}","starred_url":"https://api.github.com/users/bradleyayers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradleyayers/subscriptions","organizations_url":"https://api.github.com/users/bradleyayers/orgs","repos_url":"https://api.github.com/users/bradleyayers/repos","events_url":"https://api.github.com/users/bradleyayers/events{/privacy}","received_events_url":"https://api.github.com/users/bradleyayers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-13T13:44:53Z","updated_at":"2016-12-13T14:08:55Z","closed_at":null,"body":"The current `index.js` uses a UMD style wrapper that has a CommonJS style `module.exports = mod()`, where `mod()` returns a function (rather than an object).\r\n\r\nThis means that the library isn't able to be imported into an ES6 module unless a hack is used in the packer (e.g. webpack) that translates `import Foo from 'browserkeymap'` to  `require('browserkeymap')` rather than `require('browserkeymap').default`.\r\n\r\nThis causes a problem for libraries that depend on browserkeymap that want to distribute ES6 modules, as it burdens their consumers with needing their packer configured in this way.\r\n\r\nThe simplest solution here is to do the export in an ES6 compatible way, i.e.:\r\n\r\n```\r\nmodule.exports = { Keymap: Keymap };\r\n```\r\n\r\nor perhaps just adding:\r\n\r\n```\r\nKeymap.default = Keymap;\r\n```"},"comment":{"url":"https://api.github.com/repos/marijnh/browserkeymap/issues/comments/266747257","html_url":"https://github.com/marijnh/browserkeymap/issues/4#issuecomment-266747257","issue_url":"https://api.github.com/repos/marijnh/browserkeymap/issues/4","id":266747257,"user":{"login":"marijnh","id":144427,"avatar_url":"https://avatars.githubusercontent.com/u/144427?v=3","gravatar_id":"","url":"https://api.github.com/users/marijnh","html_url":"https://github.com/marijnh","followers_url":"https://api.github.com/users/marijnh/followers","following_url":"https://api.github.com/users/marijnh/following{/other_user}","gists_url":"https://api.github.com/users/marijnh/gists{/gist_id}","starred_url":"https://api.github.com/users/marijnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marijnh/subscriptions","organizations_url":"https://api.github.com/users/marijnh/orgs","repos_url":"https://api.github.com/users/marijnh/repos","events_url":"https://api.github.com/users/marijnh/events{/privacy}","received_events_url":"https://api.github.com/users/marijnh/received_events","type":"User","site_admin":false},"created_at":"2016-12-13T14:08:55Z","updated_at":"2016-12-13T14:08:55Z","body":"I don't know what Webpack is doing here, but auto translating CommonJS modules into ES6 modules isn't something that is generally possible. But if you're going to try it, I would expect assigning to `module.exports` to lead to a `default` export, not breaking the tool. I mean, half the modules on NPM are doing this.\r\n\r\nAnyway, note that current ProseMirror versions don't use this library anymore. If you want to submit a patch I'll merge it, but the library doesn't really have much of a future."}}
{"actor":{"display_login":"marijnh"}}