Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack hide stack trace from babel errors

I have a relatively standard webpack setup: webpack + babel-stage-0

If there's a syntax error, babel gives me a very helpful error message but there's also a stack trace completely irrelevant to my code, which is often longer than the terminal itself.

enter image description here

Is there a way to hide the stacktrace from Parser.pp.raise

I know this is a very minor thing, but having the stack trace hidden will mean less visual noise, and I dont have to scroll up half a terminal window to see my error message.

Things I've tried

I tried hiding stderr with:

webpack --watch > /dev/null

but it didn't seem to help.

like image 263
skyronic Avatar asked Jan 16 '16 14:01

skyronic


1 Answers

I've been having the same problem and there are apparently no real solutions to this. So I came up with a hack:

$ webpack --watch --color | grep -v '^ at .*/node_modules/'

This will filter webpack output to remove traceback for the node_modules dir, and the --color option ensures that grep doesn't remove your colors

like image 96
megapctr Avatar answered Nov 04 '22 08:11

megapctr