title: Include library from data directory in main.js in Firefox add-on
body: <p>In my Firefox add-on using the Add-on SDK, I'm trying to include two library files from the <code>data</code> directory in <code>main.js</code>, and it's not working.</p>
  
  <p>I have the following directory structure:</p>
  
  <pre><code>data
  -- jquery-latest.min.js
  -- pagemodscript.js
  -- mylibrary.js
  
  lib
  -- main.js
  </code></pre>
  
  <p><code>pagemodscript.js</code> uses jQuery, and that works (using <code>contentScriptFile</code>).</p>
  
  <p>I also want to use jQuery and <code>mylibrary.js</code> in <code>main.js</code>, but that's not working.</p>
  
  <p>Various things I've tried result in error messages "ReferenceError: [class in mylibrary.js] is not defined", "ModuleNotFoundError: unable to satisfy: require(mylibrary.js)", and "has no authority to load".</p>
  
  <p>I tried moving <code>mylibrary.js</code> and copying <code>jquery-latest.min.js</code> to <code>lib</code>, but that resulted in one of those error messages.</p>
  
  <p>What's the best way to set this up?</p>
  
  <p>Note: the reason I want to use jQuery in <code>main.js</code> is because - after an event generated by <code>pagemodscript.js</code> - I want <code>main.js</code> to add a div to the current page in which it will display a list of objects it created from another event generated by <code>pagemodscript.js</code>. Is the better practice to have <code>pagemodscript.js</code> create those objects and create the div? In that case, this would work: I'd load <code>mylibrary.js</code> into <code>pagemodscript.js</code> using <code>contentScriptFile</code>. In that case, <code>pagemodscript.js</code> would be creating objects of the class defined in <code>mylibrary.js</code>, and that doesn't seem as good a design as the way I'd prefer to do things.</p>