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

Can't set breakpoint in webworker #9

Closed
doxxx opened this issue May 10, 2015 · 10 comments
Closed

Can't set breakpoint in webworker #9

doxxx opened this issue May 10, 2015 · 10 comments
Labels

Comments

@doxxx
Copy link

doxxx commented May 10, 2015

I'm using browserify and webworkify with sourcemaps but any breakpoint I set in the sourcemap'd file in Chrome is not hit.

My gulpfile task looks like this:

gulp.task('processjs', function () {
  var b = browserify({
    entries: 'app/js/app.js',
    debug: true,
    transform: [cacheify(babelify, babelifyCache), cacheify(ngAnnotate, ngAnnotateCache)]
  });

  return b.bundle()
    .on('error', errorHandler)
    .pipe(source('all.js'))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: true}))
    // post-browserify transform tasks go here
    .pipe(uglify())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('dist'));
});
@kumavis
Copy link

kumavis commented May 14, 2015

are you sure your transforms are not the problem?

@doxxx
Copy link
Author

doxxx commented May 14, 2015

I have no idea, I'm kinda new to this.

However, when an error occur in the webworkified worker, the stopping point in the Chrome debugger is in an embedded data URI. I.e. the source of the worker has been converted into a data URI. So, it's not actually executing the source that was transformed by browserify, which would have sourcemap annotations.

@doxxx
Copy link
Author

doxxx commented May 14, 2015

Also, I can set breakpoints in other code which was processed by the same set of transforms.

@kumavis
Copy link

kumavis commented May 14, 2015

in the mean time you can use debugger

@doxxx
Copy link
Author

doxxx commented May 15, 2015

Could you elaborate a little on what you mean by debugger?

@doxxx
Copy link
Author

doxxx commented May 15, 2015

I see, thanks.

@tnrich
Copy link

tnrich commented Jul 23, 2015

Also running into this issue. The debugger statement does work, but it would be nice to be able to set breakpoints as well. Anyone had any luck getting breakpoints to work?

Edit: Just realized that once the debugger statement has been hit, you can set breakpoints within that file and they'll be hit as well.

@mourner
Copy link
Collaborator

mourner commented Sep 7, 2016

This is something that's not possible to fix because worker sources are created dynamically (with blob URLs), so breakpoints you set on a generated source don't persist after reloading a page.

debugger statements are a simple and effective workaround, so I'm closing the issue as not actionable.

@mourner mourner closed this as completed Sep 7, 2016
@mourner mourner added the wontfix label Sep 7, 2016
@jfirebaugh
Copy link

jfirebaugh commented Sep 7, 2016

See also http://stackoverflow.com/a/24198720/52207. Once the webworker is paused on start, you can set breakpoints within it.

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

No branches or pull requests

5 participants