Skip to content

How to debug _esm javascript code? #776

Answered by manzt
violagoodacre asked this question in JavaScript
Discussion options

You must be logged in to vote

Thanks for bringing this up! The way anywidget ensures compatibility with Jupyter involves dynamically regenerating the JavaScript module (via dataurl), which is why I'm guessing setting breakpoints directly in Chrome DevTools doesn’t seem to work. If/when #628 lands, I think this could change this behavior and allow setting breakpoints in the UI... but not sadly not currently.

Personally, if I need to debug, I usually add a debugger statement directly in the source code. This reliably triggers the debugger in Chrome DevTools. For example:

function render({ model, el }) {
    let count = () => model.get("value");
    let btn = document.createElement("button");
    btn.innerHTML = `count i…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@violagoodacre
Comment options

Answer selected by violagoodacre
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants