All Projects → stefanwalther → es6-debug-webstorm

stefanwalther / es6-debug-webstorm

Licence: other
How to debug ES6 in Webstorm (using gulp)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to es6-debug-webstorm

json2ts
a jetbrain inttellij plugin convert json to typescript
Stars: ✭ 25 (-58.33%)
Mutual labels:  webstorm
canopy
Web Audio API programming/debugging suite
Stars: ✭ 67 (+11.67%)
Mutual labels:  debugging
wirebug
Toggle Wi-Fi debugging on Android without a USB cable (needs root)
Stars: ✭ 33 (-45%)
Mutual labels:  debugging
elm-monitor
Monitor your elm program with redux-devtools
Stars: ✭ 20 (-66.67%)
Mutual labels:  debugging
cproto
Chrome Debugging client for Python
Stars: ✭ 29 (-51.67%)
Mutual labels:  debugging
gdbstub
An ergonomic and easy-to-integrate implementation of the GDB Remote Serial Protocol in Rust, with full no_std support.
Stars: ✭ 158 (+163.33%)
Mutual labels:  debugging
debug.cr
Debug macro for Crystal
Stars: ✭ 86 (+43.33%)
Mutual labels:  debugging
caddy-trace
Request Debugging Middleware Plugin for Caddy v2
Stars: ✭ 25 (-58.33%)
Mutual labels:  debugging
OpenImageDebugger
An advanced in-memory image visualization plugin for GDB and LLDB on Linux, MacOS and Windows (experimental). Previously known as gdb-imagewatch.
Stars: ✭ 115 (+91.67%)
Mutual labels:  debugging
injectURLProtocol
cycript script for injecting a custom NSURLProtocol into a running application
Stars: ✭ 25 (-58.33%)
Mutual labels:  debugging
m3forth
m3forth is a forth cross-compiler for cortex-m3 ARM microcontrollers
Stars: ✭ 16 (-73.33%)
Mutual labels:  debugging
pretty trace
Love Your Ruby's Backtrace
Stars: ✭ 13 (-78.33%)
Mutual labels:  debugging
Mediator
Cross-platform GUI gRPC debugging proxy
Stars: ✭ 36 (-40%)
Mutual labels:  debugging
slabdbg
GDB plug-in that helps exploiting the Linux kernel's SLUB allocator
Stars: ✭ 55 (-8.33%)
Mutual labels:  debugging
Code-Trouble
No description or website provided.
Stars: ✭ 14 (-76.67%)
Mutual labels:  debugging
question-driven-learning
Stay hungry stay foolish
Stars: ✭ 17 (-71.67%)
Mutual labels:  debugging
madbomber
Backtrace-on-throw C++ exception logger
Stars: ✭ 17 (-71.67%)
Mutual labels:  debugging
jquery-manager
Manage jQuery and jQuery Migrate on a WordPress website, activate a specific jQuery and/or jQuery Migrate version. The ultimate jQuery debugging tool for WordPress
Stars: ✭ 27 (-55%)
Mutual labels:  debugging
guide-charles-proxy
Charles - Web Debugging Proxy Application. I want to share my experiences when I worked with Charles. It is such an amazing application for debugging and testing the presentation of UI when trying different set of data. Hope you guys will master Charles after reading this section. Let’s find out! 🖍
Stars: ✭ 22 (-63.33%)
Mutual labels:  debugging
WinDbg Scripts
Useful scripts for WinDbg using the debugger data model
Stars: ✭ 92 (+53.33%)
Mutual labels:  debugging

Debugging ES6 in WebStorm

Just a short reminder for myself how to get debugging to work in WebStorm with ES6. If it helps also you, then great! ;-)

Folder structure being used:

root
|-- src
   |-- index.js
   |-- sample.js
.babelrc
gulpfile.babel.js
package.json

Content of .babelrc:

{
 "presets": ["es2015"]
}

The setup described below uses gulp 3.x to transpile ES6 files to ES5, including source-maps, which can then be used in WebStorm to debug ES6.

Note: As soon as gulp 4.0 is out, some changes are necessary, gulp 4.0 introduces some breaking changes.

Prerequisites

Install the required modules as devDependencies:

  • babel-core
  • babel-preset-es2015
  • gulp
  • gulp-babel
  • gulp-sourcemaps
$ npm install babel-core babel-preset-es2015 gulp gulp-babel gulp-sourcemaps --save-dev

Note: babel-core and gulp can and probably should be installed globally.

Setup gulp to work with ES6

  • Instead of naming your gulp file gulpfile.js rename it to gulpfile.babel.js
  • Use the following gulp-script:
import gulp from "gulp";
import sourceMaps from "gulp-sourcemaps";
import babel from "gulp-babel";
import path from "path";

const paths = {
	es6: ['./src/**/*.js'],
	es5: './dist',
	// Must be absolute or relative to source map
	sourceRoot: path.join(__dirname, 'src')
};
gulp.task('babel', () => {
	return gulp.src(paths.es6)
			.pipe(sourceMaps.init())
			.pipe(babel({
				presets: ['es2015']
			}))
			.pipe(sourceMaps.write('.', { sourceRoot: paths.sourceRoot }))
			.pipe(gulp.dest(paths.es5));
});
gulp.task('watch', ['babel'], () => {
	gulp.watch(paths.es6, ['babel']);
});

gulp.task('default', ['watch']);

Running gulp will now create a folder dist with the transpiled scripts + sourcemaps in it.

Inspirations for this script:

Setup your project

Just as a simple example let's add the following files into ./src:

sample.js

export class Sample  {
	constructor() {
		this.prop1 = "prop1";
		this.prop2 = "prop2";
	}
}

index.js

import {Sample} from './sample';
let sample = new Sample();
console.log( sample.prop1 );
console.log( sample.prop2 );

Now run

gulp

Whenever you make changes, four file will be generated in the ./dist folder:

Debug in WebStorm

So, now let's have a look how to debug in WebStorm (version 11 is used here):

Set a breakpoint:

  • Go to the ./dist folder and create the desired breakpoint:

Start the debugger in WebStorm, by right-clicking on dist/index.js (not src/index.js !!!).

You will then get:

So, not really nice, probably a WebStorm bug. But if you hit F8 (Step Over ) you will then get

We are done, happy debugging in WebStorm! You can now set breakpoints in every of the files in the ./src/ folder (containing in this example the es6 files) and they will be hit.

Mocha setup

Configure the

Most important setting is the "Extra Mocha options" with --compilers js:babel-core/register

Further readings

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].