Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcemap support? #37

Open
davidtheclark opened this issue Jan 19, 2015 · 12 comments
Open

Sourcemap support? #37

davidtheclark opened this issue Jan 19, 2015 · 12 comments

Comments

@davidtheclark
Copy link

Should this plugin work with gulp-sourcemaps?

I'm asking because in my case it doesn't seem to --- the addition of this plugin into my stream makes the sourcemaps inaccurate.

I see no mention of "sourcemap" in the repo; so before I dug deeper I just wanted to check: Has any effort already been made to support sourcemaps with this plugin? Maybe I am missing something?

@lazd
Copy link
Owner

lazd commented Jan 21, 2015

Hmm, can you paste your gulp task so we can take a look?

@davidtheclark
Copy link
Author

It's a little bit odd because it starts with a Browserify bundle:

function bundleApp(b, cb) {
    cb = cb || _.noop;

    return b.bundle()
        .on('error', function(err) { console.error(err); })
        .pipe(vinylSourceStream('htcInit.js'))
        .pipe(vinylBuffer())
        .pipe(gSourcemaps.init({ loadMaps: true }))
        .pipe(gIf(cliOptions.nodevlog || cliOptions.dist, gReplace(devlogRegExp, '')))
        .pipe(gSourcemaps.write())
        .pipe(gulp.dest(jsDestDir))
        .on('end', cb);
}

gulp.task('js:dev', function(cb) {
    var appBundler = browserify(jsEntry, options.browserify)
        .external(vendorLibs)
        .transform(to5ify);
    bundleApp(appBundler, cb);
});

Seems that if I leave out the line that calls gReplace(), although the end result has accurate sourcemaps; but when I add it in, sourcemaps break. Maybe it's a mistake in how I'm piping things together, dealing with Browserify streams vs. vinyl streams, etc.

@lazd
Copy link
Owner

lazd commented Jan 21, 2015

Yeah, I could see how this would break things -- the source map won't match after we replace. I wonder how much work it would take to add support...

@davidtheclark
Copy link
Author

Ok, so that's not a situation that's already been taken into account. If I have the chance I'll try to look into it. And of course if you @lazd or someone else can add that support, that would be grand. Thanks.

@davidtheclark
Copy link
Author

I was hoping there would be some built-in Gulp way to make sourcemaps like magic, but I don't think there is, right? gulp-sourcemaps basically says that each plugin is responsible for creating its own sourcemaps. I have no idea how to do that, so can't promise any timely help here.

@stryju
Copy link

stryju commented Jul 24, 2015

any updates? :/

@call-a3
Copy link

call-a3 commented Sep 3, 2015

@lazd found anyone yet who could add support for this? I've been looking into it myself but at the moment I haven't got time to really put the necessary effort in...

@lazd
Copy link
Owner

lazd commented Sep 3, 2015

@call-a3 unfortunately no, and I don't have time myself :-/

@otakustay
Copy link

regexp-sourcemaps may be helpful to generate sourcemaps

@jlukic
Copy link

jlukic commented Dec 19, 2016

I've also run into this when refactoring the Semantic UI build pipeline to use sourcemaps.

Guidance on how to add sourcemap support for gulp plugins can be found here

@westy92
Copy link

westy92 commented Jun 5, 2017

Any update on this? This is the last gulp plugin we are relying on that needs sourcemap support. Other plugins that have it are listed here.

@lazd
Copy link
Owner

lazd commented Jun 5, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants