title: How to debug lazily-loaded javascripts in Safari debugger
body: <p>I have a very simple script that lazy-loads javascripts at runtime. There are unknown dependencies on each page, so they are not all loaded until needed.</p>
  
  <p>Like most frameworks, this works by adding a script tag to the document head.</p>
  
  <p>Everything executes fine, but the Safari debugger neither sees the new script tags in the "Elements" inspector, nor shows them in the "Scripts" tab. Errors are reported as occurring on the root document, rather than the proper script.</p>
  
  <p>An obvious workaround is to author and debug everything normally, and then add the dependency loading as a last step. But I would love to know if there is there a better way to lazy-load scripts that makes the debugger happier?</p>