I'm trying to get source maps for my JavaScript files working with Chrome. The problem with the current gulp script is that the source maps (that Browserify creates) lead to minified versions of files.
For example, let's say that app.jsx is an entry file for Browserify and it has require('a')
and require('b')
calls in it. app.jsx gets browserified, reactified and uglifyied and written to app.js as expected. However, all of the source maps references within module a
and module b
are also minified:
var gulp = require('gulp'),
browserify = require('browserify'),
watchify = require('watchify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
bundler;
bundler = browserify({
entries: '/app.jsx',
cache: {},
packageCache: {},
fullPaths: true
});
bundler
.transform('reactify');
.transform({
global: true
}, 'uglifyify');
bundler = watchify(bundler);
bundler.on('update', function() {
return bundler
.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(gulp.dest('/js'));
});
Any ideas of how to get this working?