{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4214","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4214/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4214/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4214/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4214","id":99640124,"number":4214,"title":"ES6 module import doesn't require relative identifier to load relative file","user":{"login":"jbrantly","id":196944,"avatar_url":"https://avatars.githubusercontent.com/u/196944?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrantly","html_url":"https://github.com/jbrantly","followers_url":"https://api.github.com/users/jbrantly/followers","following_url":"https://api.github.com/users/jbrantly/following{/other_user}","gists_url":"https://api.github.com/users/jbrantly/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrantly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrantly/subscriptions","organizations_url":"https://api.github.com/users/jbrantly/orgs","repos_url":"https://api.github.com/users/jbrantly/repos","events_url":"https://api.github.com/users/jbrantly/events{/privacy}","received_events_url":"https://api.github.com/users/jbrantly/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-07T12:39:58Z","updated_at":"2015-08-10T21:52:31Z","closed_at":null,"body":"This could be by design but it just surprised me and I wanted to verify behavior.\r\n\r\nWith CommonJS, relative modules must start with \"./\" or \"../\", otherwise it's considered to be a top-level module.\r\n\r\nAs near as I can tell with ES6, module naming is \"loader implementation specific\". It would seem that TypeScript's implementation does not require \"./\" or \"../\" to reference a relative file. For example:\r\n\r\n```typescript\r\n// dep.ts\r\n\r\nexport class Test {}\r\n\r\n// app.ts\r\n\r\nimport { Test } from 'dep';\r\n```\r\n\r\nIs this intended? I'm not super familiar with prevailing ES6 module loading standards, but I put together a quick test using SystemJS. It also does not allow referencing a relative module without './' or '../' *unless* that module happens to be in the preconfigured \"base\" URL. In other words, the above example would probably work out of the box, but the following would not:\r\n\r\n```typescript\r\n// components/helper.ts\r\n\r\nexport function someHelper();\r\n\r\n// components/dep.ts\r\n\r\nimport * as helper from 'helper'; // this line would error at runtime in SystemJS, but not in TS\r\n\r\nexport class Test {}\r\n\r\n// app.ts\r\n\r\nimport { Test } from 'components/dep';\r\n```\r\nMy understanding is that work is being made in #2338 and things like #4154 which may help to alleviate issues like this since it would allow TypeScript to be aware of that \"loader-implementation specific\" part. In the meantime, is the current default correct? As an alternative, perhaps it would make sense for ES6 imports to not have this behavior **if** --module commonjs is set, since this clearly does not follow the CJS spec.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/129623737","html_url":"https://github.com/Microsoft/TypeScript/issues/4214#issuecomment-129623737","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4214","id":129623737,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T21:52:31Z","updated_at":"2015-08-10T21:52:31Z","body":"good.. it should be soon :D"}}