title: Debugging JavaScript code that uses ES6 Modules
body: <p>TL;DR: How can I access variables/functions/names that are defined in ES Modules from the debugger?</p>
  <p>More context: I'm a relatively experienced JavaScript programmer, but new to Modules. I've followed the tutorial at MDN here: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules</a>.  They have a good set of examples here: <a href="https://github.com/mdn/js-examples/tree/master/modules" rel="nofollow noreferrer">https://github.com/mdn/js-examples/tree/master/modules</a></p>
  <p>In that collection, say in the &quot;basic-modules&quot; example, (live code here: <a href="https://mdn.github.io/js-examples/modules/basic-modules/" rel="nofollow noreferrer">https://mdn.github.io/js-examples/modules/basic-modules/</a>) there is, for example, a function called <code>random</code> in the file <code>modules/square.js</code>. Suppose I want to execute that function in the debugger, just to try it out, or because it's my code and I want to test/debug it, or I want to demonstrate to another coder what the function does. All the stuff you expect to do in a REPL or debugger. Is there a way to do that? I've tried both the Firefox debugger and the Chrome debugger, with no luck.</p>
  <p>Back in the pre-Modules era, that code would be put into the global namespace (making access easy) or it would be locked up in an IIFE (making access impossible) or maybe in some home-made module system (access depends). I am hoping that the new Modules system still allows the debugger access to the names inside modules.</p>
  <p>Thanks.</p>