jlouns / gulp-requirejs-optimize

Wrapper for the requirejs optimizer for use in gulp
MIT License
62 stars 9 forks source link

Extra sourceMappingURL #17

Closed cubitus81 closed 8 years ago

cubitus81 commented 8 years ago

Hi,

I tried using gulp-requirejs-optimize with sourcemaps and find that the optimized file contains two lines of sourceMappingURL

//# sourceMappingURL=main.js.build.js.map //# sourceMappingURL=main-optimized.min.js.map

The first line should not be in the optimized file. Is there a setting that I should use to remove the first line?

Here is the code that I have.

var $ = require('gulp-load-plugins')();
gulp.task('optimize', function () {
        gulp.src('app/scripts/main.js')
            .pipe($.sourcemaps.init())
            .pipe($.requirejsOptimize({
                mainConfigFile: 'app/scripts/main.js',
                out: 'main-optimized.min.js',

            }))
             .pipe($.sourcemaps.write('/'))
            .pipe(gulp.dest('dist/scripts'));

});

Thank you.

jlouns commented 8 years ago

I'm not able to reproduce this with my project. Are you able to create a minimal example that contains the issue?

cubitus81 commented 8 years ago

Hi Jonathan,

Please find my example. If it matters, I am still using npm 2. UI.zip

Thank you for your help.

jlouns commented 8 years ago

This is definitely a bug. uglify adds its own sourceMappingURL comment during minification which gets duplicated by gulp-sourcemaps. I'm working on a fix now.