Create-react-app: Find a way to preserve line numbers in error messages / stack traces

Created on 8 Sep 2016  路  12Comments  路  Source: facebook/create-react-app

Seeing incorrect line numbers in stack traces breaks workflow too much.

We could try to either use line preserving code transformations (does Babel support that?) or enable more advanced Webpack's devtool (cheap-module-eval-source-map).

Most helpful comment

I strongly believe that source maps is better than no source maps even in the current state. We should definitely file issues with upstream projects, but in the short term I'm not aware of any development teams that intentionally disable source maps in development.

All 12 comments

I strongly believe that source maps is better than no source maps even in the current state. We should definitely file issues with upstream projects, but in the short term I'm not aware of any development teams that intentionally disable source maps in development.

I'm open to enabling them but not without somebody compiling a list of issues that need to be addressed in other projects for them to work seamlessly.

Isn't it just the need for a variable name map? i.e. currently dev-tools requires you to see the name of the variables after compilation rather than the name they had in the source code. 95% of the time those are the same thing anyway (unless you add a minifier), but it is still worth pushing to get fixed.

95% of the time those are the same thing anyway (unless you add a minified)

I think imported names are mangled and this is not 5%.

Isn't it just the need for a variable name map?

Yeah, maybe. At least if cheap-module-source-map truly works well with breakpoints unlike some of its friends (IIRC, cheap-module-eval-source-map) that complete confuse debugger in Chrome.

Another thing to watch out for is hot reloading support. We don鈥檛 have it right now but I鈥檇 like to see us be ready to it in the future. I know sourcemap support for it was fixed for eval but not sure if they get updated for cheap-module-source-map, for example, and whether we need to file more Chrome bugs.

95% of the time those are the same thing anyway

I鈥檓 not sure this was my experience with destructuring (or some other common ES features) but worth double checking. Imports are confusing too, I wish there was a way around that while preserving ES modules semantics.

Not having source maps is definitely problematic. Chrome chrashes on my Macbook Pro if I try to do searches and add breakpoints in bundle.js.

... and when it actually works, it's unintelligible garble due to the eval thingee.

@mpj

Can you put breakpoints in the modules instead?

@gaearon I don't understand. In my installation ("react-scripts": "0.6.1"), everything is just one big bundle.js.

@gaearon oh, I get what you mean now, I have to expand into the webpack:// thingee. That works!

does/will this issue cover also line numbers in test/jest stack traces?

We have sourcemaps now so probably not relevant anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jnachtigall picture jnachtigall  路  3Comments

alleroux picture alleroux  路  3Comments

oltsa picture oltsa  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments

dualcnhq picture dualcnhq  路  3Comments