{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/1035","labels_url":"https://api.github.com/repos/babel/babel/issues/1035/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/1035/comments","events_url":"https://api.github.com/repos/babel/babel/issues/1035/events","html_url":"https://github.com/babel/babel/issues/1035","id":62186565,"number":1035,"title":"Sourcemaps not quite working with babel/register","user":{"login":"cowboy","id":54051,"avatar_url":"https://avatars.githubusercontent.com/u/54051?v=3","gravatar_id":"","url":"https://api.github.com/users/cowboy","html_url":"https://github.com/cowboy","followers_url":"https://api.github.com/users/cowboy/followers","following_url":"https://api.github.com/users/cowboy/following{/other_user}","gists_url":"https://api.github.com/users/cowboy/gists{/gist_id}","starred_url":"https://api.github.com/users/cowboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cowboy/subscriptions","organizations_url":"https://api.github.com/users/cowboy/orgs","repos_url":"https://api.github.com/users/cowboy/repos","events_url":"https://api.github.com/users/cowboy/events{/privacy}","received_events_url":"https://api.github.com/users/cowboy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-16T19:33:26Z","updated_at":"2015-03-17T01:08:11Z","closed_at":"2015-03-17T01:08:11Z","body":"I'm assuming that sourcemaps are supposed to be working with `require('babel/register')` because when I take this `test.js` file:\r\n\r\n```js\r\nvar {a, b} = {a: 1, b: 2};\r\nconsole.log(a, b);\r\nx\r\n```\r\n\r\nAnd run `node -e \"require('babel/register'); require('./test');\"` with babel 4.7.12, I see line **3** (the source line of the ReferenceError) instead of **8** (the compiled line of the ReferenceError) in the first line of the stack trace:\r\n\r\n```\r\n1 2\r\n\r\n/Users/cowboy/repos/cowboy/test/test.js:8\r\nx;\r\n^\r\nReferenceError: x is not defined\r\n    at Object.<anonymous> (/Users/cowboy/repos/cowboy/test/test.js:3:1)\r\n    at Module._compile (module.js:456:26)\r\n    at normalLoader (/Users/cowboy/repos/cowboy/test/node_modules/babel/lib/babel/api/register/node.js:119:5)\r\n    at Object.require.extensions.(anonymous function) [as .js]\r\n    (/Users/cowboy/repos/cowboy/test/node_modules/babel/lib/babel/api/register/node.js:132:7)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:312:12)\r\n    at Module.require (module.js:364:17)\r\n    at require (module.js:380:17)\r\n    at [eval]:1:28\r\n    at Object.<anonymous> ([eval]-wrapper:6:22)\r\n```\r\n\r\nUnfortunately, line **3** isn't mentioned in the initial error line (at the top, before the `x;` bit). Is that an error?\r\n\r\nAlso, if sourcemaps are indeed supposed to be supported, the paths could be better formatted. For example, if I compile `test.js` with `node_modules/.bin/babel --source-maps-inline test.js > test-compiled.js` I get this file (with the ReferenceError on line 8):\r\n\r\n```js\r\n\"use strict\";\r\n\r\nvar _ref = { a: 1, b: 2 };\r\nvar a = _ref.a;\r\nvar b = _ref.b;\r\n\r\nconsole.log(a, b);\r\nx;\r\n\r\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7V0FBWSxFQUFDLENBQUMsRUFBQyxDQUFDLEVBQUMsQ0FBQyxFQUFDLENBQUMsRUFBQztJQUFoQixDQUFDLFFBQUQsQ0FBQztJQUFDLENBQUMsUUFBRCxDQUFDOztBQUNSLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDO0FBQ2xCLENBQUMsQ0FBQSIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIge2EsYn0gPSB7YToxLGI6Mn07XG5jb25zb2xlLmxvZyhhLCBiKTtcbnhcbiJdfQ==\r\n```\r\n\r\nAnd then run it with `node -e \"require('source-map-support').install(); require('./test-compiled');\"` I see this output with short paths and a reference to line 3 in both places. Although I still do see the reference to line 8 as well.\r\n\r\n```\r\n1 2\r\n\r\n/Users/cowboy/repos/cowboy/js-es6-es7-workflow-ideas/test-compiled.js:8\r\nx;\r\n^\r\n\r\ntest.js:3\r\nx\r\n^\r\nReferenceError: x is not defined\r\n    at Object.<anonymous> (test.js:3:1)\r\n    at Module._compile (module.js:456:26)\r\n    at Object.Module._extensions..js (module.js:474:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:312:12)\r\n    at Module.require (module.js:364:17)\r\n    at require (module.js:380:17)\r\n    at [eval]:1:42\r\n    at Object.<anonymous> ([eval]-wrapper:6:22)\r\n    at Module._compile (module.js:456:26)\r\n```\r\n\r\nIf sourcemaps are supposed to be working with `babel/register`, could they be a little more consistent and nicely formatted?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/82015599","html_url":"https://github.com/babel/babel/issues/1035#issuecomment-82015599","issue_url":"https://api.github.com/repos/babel/babel/issues/1035","id":82015599,"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-03-17T01:08:11Z","updated_at":"2015-03-17T01:08:11Z","body":"> Unfortunately, line 3 isn't mentioned in the initial error line (at the top, before the x; bit). Is that an error?\r\n\r\nYou're right that in the following the line is incorrect:\r\n\r\n```\r\n/Users/cowboy/repos/cowboy/test/test.js:8\r\nx;\r\n^\r\n```\r\n\r\nHowever the following number is correct:\r\n\r\n```\r\nReferenceError: x is not defined\r\n    at Object.<anonymous> (/Users/cowboy/repos/cowboy/test/test.js:3:1)\r\n```\r\n\r\nThis is due to #899 as otherwise it requires overriding `uncaughtException ` which interferes with a lot of libraries.\r\n\r\nBasically the top code frame that Node inserts is incorrect as `babel/register` sets the `handleUncaughtExceptions` `source-map-support` option to `false`."}}