1

I am using Browserify with one transform method: reactify. Here is how I build my scripts:

gulp.task('scripts', function() {
    var b = null, watcher = null;

    function bundle() {
        return b
            .on('error', function(err) { console.error(err) })
            .bundle()
            .pipe(source('bundle.js'))
            .pipe(gulp.dest('dest/scripts'));
    }

    b = browserify({
            debug: true,
            entries: ['app/index.jsx'],
            transform: [ reactify ],
            extensions: [ '.jsx' ],
            cache: {}, packageCache: {}, fullPaths: true
        });

    if (config.watch) {
        b = watchify(b);
        b.on('update', bundle);
    }

    return bundle();
});

When running the app locally I the source maps are correct and in the dev tools I can see the original jsx file.
This problem starts when I add another transform. Then when running and looking in dev tools, I don't get the original file. Instead I get the jsx files AFTER compilation. I tried that with es6ify, uglifyfy and envify (reactify + es6ify, reactify + uglifyfy, reactify + envify) and I get the same incorrect behavior.
It has to be something wrong I do with the source maps configuration or a bug in browserify.
Any idea how to fix it?

Naor
  • 23,465
  • 48
  • 152
  • 268
  • The only thing that would come into my mind is: If you change a file that has already a source map, then the tool you use to do another _transformation_ needs to accept/use the existing source map to be able to generate the new one. But I don't know if this actually the case in your setup. – t.niese Jan 27 '15 at 22:56
  • @t.niese I agree with you, but browserify transformations doesn't have any configurations related to source maps. They should be able to take existing source maps by default but I don't know if this is handled or a browserify bug. – Naor Jan 27 '15 at 23:07
  • Might this be related [browserify-generated sourcemap contains output from JSX instead of input](https://github.com/andreypopp/reactify/issues/19)? – t.niese Jan 27 '15 at 23:10
  • @t.niese I saw it today. Added a comment there to know whether this is the problem. – Naor Jan 27 '15 at 23:17

0 Answers0