evanw / evanw/node-source-map-support

Only first line working?

Aperta
#183 2 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2.2k
Fork
223
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

`node v8.0.0`

src/throw-err.js (not compiled)

```javascript
import 'source-map-support/register'

const main = async () => {
throw new Error('wooot')
}

main().catch(console.error)
```

lib/throw-err.js (compiled with babel)

```javascript
'use strict';

require('source-map-support/register');

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

const main = (() => {
var _ref = _asyncToGenerator(function* () {
throw new Error('wooot');
});

return function main() {
return _ref.apply(this, arguments);
};
})();

main().catch(console.error);
//# sourceMappingURL=throw-err.js.map

```

lib/throw-err.js.map (source map)

```json
{"version":3,"sources":["../src/throw-err.js"],"names":["main","Error","catch","console","error"],"mappings":";;AAAA;;;;AAEA,MAAMA;AAAA,+BAAO,aAAY;AACvB,UAAM,IAAIC,KAAJ,CAAU,OAAV,CAAN;AACD,GAFK;;AAAA;AAAA;AAAA;AAAA,IAAN;;AAIAD,OAAOE,KAAP,CAAaC,QAAQC,KAArB","file":"throw-err.js","sourcesContent":["import 'source-map-support/register'\n\nconst main = async () => {\n throw new Error('wooot')\n}\n\nmain().catch(console.error)\n"]}
```

```
$ node lib/throw-err.js
Error: wooot
at /Users/olalonde/code/binded/filepunk/src/throw-err.js:4:9
at Generator.next ()
at step (/Users/olalonde/code/binded/filepunk/lib/throw-err.js:5:191)
at /Users/olalonde/code/binded/filepunk/lib/throw-err.js:5:437
at Promise ()
at /Users/olalonde/code/binded/filepunk/lib/throw-err.js:5:99
at main (/Users/olalonde/code/binded/filepunk/src/throw-err.js:3:7)
at Object. (/Users/olalonde/code/binded/filepunk/src/throw-err.js:7:1)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
```

Why Is only the first line of the stack trace correct? `at Generator.next ()` and lines with `lib/` should not be there.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.