Created
March 2, 2015 14:59
-
-
Save rmartone/bba859b05e70de52e160 to your computer and use it in GitHub Desktop.
Gulp exceprt to Browserify Typescript with sourcemaps that work with Webstorm’s built-in debugger.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Browserify Typescript with sourcemaps that Webstorm can use. | |
* The other secret ingredient is to map the source directory to the | |
* remote directory through Webstorm's "Edit Configurations" dialog. | |
*/ | |
'use strict'; | |
var gulp = require('gulp'), | |
browserify = require('browserify'), | |
tsify = require('tsify'), | |
sourcemaps = require('gulp-sourcemaps'), | |
buffer = require('vinyl-buffer'), | |
source = require('vinyl-source-stream'); | |
var config = { | |
client: { | |
outDir: './public/scripts', | |
out: 'app.js', | |
options: { | |
browserify: { | |
entries: './src/client/main.ts', | |
extensions: ['.ts'], | |
debug: true | |
}, | |
tsify: { | |
target: 'ES5', | |
removeComments: true | |
} | |
} | |
} | |
}; | |
gulp.task('client', function () { | |
return browserify(config.client.options.browserify) | |
.plugin(tsify, config.client.options.tsify) | |
.bundle() | |
.on('error', function (err) { | |
console.log(err.message); | |
}) | |
.pipe(source(config.client.out)) | |
.pipe(buffer()) | |
.pipe(sourcemaps.init({loadMaps: true})) | |
.pipe(sourcemaps.write('./', {includeContent: false, sourceRoot: '/scripts'})) | |
.pipe(gulp.dest(config.client.outDir)); | |
}); |
I believe this required setting up folder mappings in Webstorm. I've since moved to Webpack and found inline sourcemaps more resilient.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't seem to be working for me. Would you mind taking a screenshot of your folder structure and run configuration in Webstorm?