evanw / evanw/node-source-map-support
Source maps not working with standard input
- Langage dominant
- JavaScript
- Étoiles
- 2.2k
- Forks
- 223
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Below is the source file I am using:
```js
require('source-map-support').install();
throw new Error('error on line two');
```
The following command will generate the __correct__ output:
```sh
node dist/bundle.js
```
output:
```
/Users/nick/Desktop/dist/webpack:/example/index.js:2
throw new Error('error on line two');
^
Error: error on line two
at Object. (/Users/nick/Desktop/dist/webpack:/example/index.js:2:1)
at __webpack_require__ (/Users/nick/Desktop/dist/webpack:/webpack/bootstrap 8d9d0b53441c2ea13b08:19:1)
at /Users/nick/Desktop/dist/webpack:/webpack/bootstrap 8d9d0b53441c2ea13b08:39:1
at Object. (/Users/nick/Desktop/dist/bundle.js:43:10)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
```
The following command with __not__ generate a line number or other source map information:
```sh
cat dist/bundle.js | node
```
output:
```
Error: error on line two
at Object. ([stdin]:48:8)
at __webpack_require__ ([stdin]:20:30)
at [stdin]:40:18
at [stdin]:43:10
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at Object.exports.runInThisContext (vm.js:74:17)
at Object. ([stdin]-wrapper:6:22)
at Module._compile (module.js:571:32)
at Immediate. (bootstrap_node.js:387:29)
at runCallback (timers.js:651:20)
```
The issue seems to arise when passing a script via standard input to node. I originally discovered it when I was creating a child process in node and passing generated code to it.
Please let me know if any more information is needed.
Thank you for your time in supporting this awesome project, and for taking the time to help me.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par reproduire le problème avec `node dist/bundle.js` et `cat dist/bundle.js | node`, en comparant les traces de pile source-mapped et `[stdin]` affichées ici. Suivez la manière dont source-map-support traite les scripts fournis via l’entrée standard. Le travail est terminé lorsque l’invocation via l’entrée standard signale l’emplacement d’origine dans le code source et les informations de ligne, avec un test de régression couvrant les deux commandes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, node.js
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100