{"action":"closed","issue":{"url":"https://api.github.com/repos/catamphetamine/libphonenumber-js/issues/200","repository_url":"https://api.github.com/repos/catamphetamine/libphonenumber-js","labels_url":"https://api.github.com/repos/catamphetamine/libphonenumber-js/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/catamphetamine/libphonenumber-js/issues/200/comments","events_url":"https://api.github.com/repos/catamphetamine/libphonenumber-js/issues/200/events","html_url":"https://github.com/catamphetamine/libphonenumber-js/issues/200","id":310268291,"number":200,"title":"Different behavior in node vs webpack","user":{"login":"rytakahashi","id":35181774,"avatar_url":"https://avatars0.githubusercontent.com/u/35181774?v=4","gravatar_id":"","url":"https://api.github.com/users/rytakahashi","html_url":"https://github.com/rytakahashi","followers_url":"https://api.github.com/users/rytakahashi/followers","following_url":"https://api.github.com/users/rytakahashi/following{/other_user}","gists_url":"https://api.github.com/users/rytakahashi/gists{/gist_id}","starred_url":"https://api.github.com/users/rytakahashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rytakahashi/subscriptions","organizations_url":"https://api.github.com/users/rytakahashi/orgs","repos_url":"https://api.github.com/users/rytakahashi/repos","events_url":"https://api.github.com/users/rytakahashi/events{/privacy}","received_events_url":"https://api.github.com/users/rytakahashi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-31T20:08:25Z","updated_at":"2018-04-01T06:33:03Z","closed_at":"2018-04-01T06:33:03Z","author_association":"NONE","body":"\r\nHello,\r\n\r\nIt seems the package recommends importing using the following method (link [here](https://github.com/catamphetamine/libphonenumber-js#usage)).\r\n\r\n```javascript\r\nimport { parse, format, AsYouType } from 'libphonenumber-js'\r\n```\r\n\r\nHowever, in medium to large files, `parse` and `format` tend to be common variable names so we are importing as follows.\r\n\r\n```javascript\r\nimport libphonenumber from 'libphonenumber-js'\r\n```\r\n\r\nThis seems to work fine in node but in the browser (webpack) `libphonenumber` is undefined and we need to import as follows.\r\n\r\n```javascript\r\nimport * as libphonenumber from 'libphonenumber-js'\r\n```\r\n\r\nIf I were to guess, it seems like `module.exports` is being set in the [common environment](https://github.com/catamphetamine/libphonenumber-js/blob/master/index.common.js#L6) but there is no equivalent in the es6 environment.\r\n\r\nI am uncertain whether one method is preferred over the other, but from an API perspective I think it's a good idea to support both so the code behaves the same way in all environments.\r\n"}}
{"actor":{"display_login":"catamphetamine"}}