Reputation: 7839
I have been trying to find a way to write ES6 JavaScript code, with real-time debugging features.
The problem is that ES6 code needs transpiling before browsers can interpret it (easy with babel), thus making it hard to work with debugging breakpoints.
I found these two articles helpful:
My question:
What are skilled JavaScript developers doing about the above issue these days? Any of the three below?
Upvotes: 1
Views: 1057
Reputation: 580
I spent a few hours on the same exact challenge myself, in Visual Studio Code.
I won't take credit for solving it, praise for that goes to Dustin Callaway. You can find simple step by step instructions in his medium article here.
In summary (debugging transpiled code in Visual Studio Code):
Dustin's instructions let you debug ES6 files real-time in Visual Studio Code.
Whenever you are ready for production, just recompile and bundle with Babel and Webpack.
Upvotes: 1
Reputation: 497
Source maps seem to be the simplest way for debugging code, for me at least.
Upvotes: 0
Reputation: 2714
Most commercial projects I've worked on in the last few years have been set up so you write ES6 code, use Webpack, Babel/ Babel-Loader, with source-maps enabled.
Debug easily then in Chrome dev tools.
Upvotes: 1