{"action":"created","issue":{"url":"https://api.github.com/repos/6to5/6to5/issues/493","labels_url":"https://api.github.com/repos/6to5/6to5/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/6to5/6to5/issues/493/comments","events_url":"https://api.github.com/repos/6to5/6to5/issues/493/events","html_url":"https://github.com/6to5/6to5/issues/493","id":54368997,"number":493,"title":"`import` cannot import Joi","user":{"login":"jakecraige","id":3799709,"avatar_url":"https://avatars.githubusercontent.com/u/3799709?v=3","gravatar_id":"","url":"https://api.github.com/users/jakecraige","html_url":"https://github.com/jakecraige","followers_url":"https://api.github.com/users/jakecraige/followers","following_url":"https://api.github.com/users/jakecraige/following{/other_user}","gists_url":"https://api.github.com/users/jakecraige/gists{/gist_id}","starred_url":"https://api.github.com/users/jakecraige/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakecraige/subscriptions","organizations_url":"https://api.github.com/users/jakecraige/orgs","repos_url":"https://api.github.com/users/jakecraige/repos","events_url":"https://api.github.com/users/jakecraige/events{/privacy}","received_events_url":"https://api.github.com/users/jakecraige/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/6to5/6to5/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2015-01-14T20:01:32Z","updated_at":"2015-01-25T09:43:38Z","closed_at":"2015-01-25T03:03:36Z","body":"I was attempting to import [Joi](https://github.com/hapijs/joi) like\r\n\r\n```js\r\n// what I had\r\nvar Joi = require('joi');\r\n\r\n// changed to\r\nimport Joi from 'joi';\r\n```\r\n\r\nWhich caused some weird errors like this and my app wouldn't run. \r\n\r\n```\r\nTypeError: Object function (value) {\r\n    var obj = this.clone();\r\n    obj._flags.default = value;\r\n    Ref.push(obj._refs, value);\r\n    return obj;\r\n} has no method 'number'\r\n```\r\n\r\nTurns out that Joi provides a `default` method  so the _interopRequire returns that instead of the main object\r\n\r\n```js\r\nvar _interopRequire = function (obj) {\r\n  return obj && (obj[\"default\"] || obj);\r\n};\r\n```\r\n\r\nOther than Joi not exposing a `.default` method, I can't see any way this could be fixed. So I'm just using node's require for now. I just wanted this to be searchable for anyone who came across this issue. \r\n\r\nOne possible solution would be for 6to5 to use a different name for the default export, like `_default`. Even with that though there is still the possibility of a naming conflict. I can't think of any real nice solution off the top of my head. "},"comment":{"url":"https://api.github.com/repos/6to5/6to5/issues/comments/71363035","html_url":"https://github.com/6to5/6to5/issues/493#issuecomment-71363035","issue_url":"https://api.github.com/repos/6to5/6to5/issues/493","id":71363035,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-01-25T09:43:38Z","updated_at":"2015-01-25T09:43:38Z","body":"@impinball My concerns are with adding in magic and complicated behaviour for module behaviour. Basing behaviour on module paths doesn't make a whole lot of sense and is bound to run into issues and complications."}}