question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-register aleary use source-map-support!

See original GitHub issue

I want to use the source map with universal-webpack and babel, but babel-register aleardy use source-map-support, which change the node default error handler. If I import 'source-map-support/register', it will change it twice, which cause the source map output the wrong path.

And I find out when babel-register use source-map-support, it map from the memory running code to the complied file, not from complied file to all source files. How can I generate right source map? @catamphetamine

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
FTAndycommented, Sep 4, 2017

babel-register use source-map-support by default, and compile code in runtime, which will make node error stack out of order. you can debug in babel-register’s node_modules source-map-support’s source-map-support.js file, where prepareStackTrace will take care of the native prepareStackTrace function and process compiled file to the source file.

but if you disable babel-register and enable source-map-support to the top of server.js, and run the server.js file, then throw new Error('aaa'), the output error stack log will be right. but was wrong when enable babel-register and disable source-map-support.@catamphetamine

0reactions
catamphetaminecommented, Sep 4, 2017

I see, so babel-register has its own source maps generated which screws line numbers up. Removing babel-register from the readme then. Thx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source map weirdness when using @babel/register . #1899
In the second scenario it may just be that @babel/register pulls in an outdated source-map-support , which itself pulls in an outdated source-...
Read more >
node.js - @babel/register support source maps on runtime
I understand that source-map-support does not work. VSCode debugging goes well. The editor see and understand source maps. Help me to make ...
Read more >
babel-plugin-source-map-support
An easy way to limit the plugin's scope to development/test builds is to use Babel's env option, e.g.:
Read more >
Using Node.js sourcemaps with Node.js and Babel
Enable sourceMaps when transpiling code using Babel. · Use babel-plugin-source-map-support to override stack trace. · Use RewriteFrames plugin to ...
Read more >
babel-plugin-source-map-support - npm package
A Babel plugin which automatically makes stack traces source-map aware For more information about how to use this package see README.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found