title: Custom Module in SuiteScript 2.0
body: <p>I have a JavaScript library file that I use throughout my scripts when creating SuiteScripts for NetSuite. I'm trying to get myself all prepped on 2.0 and start pushing new projects to it and get away from SuiteScript 1.0. So, I transcribed my library file into 2.0. However, whenever I create a new script and have my library referenced, I always get the following message:</p>
  
  <pre><code>SuiteScript 2.0 entry point scripts must implement one script type function.
  </code></pre>
  
  <p>But, if I remove the reference from the script, it lets me load it up and create the script record. Then I can put the reference back and upload the revised script file without issue. I can't for the life of me understand why this happens. If it matters, here is the JSDoc header in the file:</p>
  
  <pre><code>/** 
   * my.library.v2.js
   * @NApiVersion 2.x
   * @NModuleScope Public 
   */
  </code></pre>
  
  <p>A script would also start off like this after its own JSDoc header:</p>
  
  <pre><code>define(['N/error', 'N/record', 'N/runtime', 'N/search', './my.library.v2'],
  function(error, record, runtime, search, myLib) {
      function doStuff(context) { /* do a bunch of stuff */ }
      return { pageInit : doStuff };
  });
  </code></pre>
  
  <p>Along the same issue, I also have trouble with running some scripts. Everything works perfectly when applying this module to client scripts once I get beyond the previously mentioned issue. However, I cannot successfully get a server-side script to initiate with the library. I constantly get this error:</p>
  
  <pre><code>com.netsuite.suitescript.exception.NLServerSideScriptException: TypeError: Cannot call method "split" of undefined
  </code></pre>
  
  <p>What's throwing me off is that the library has no call of String.split() inside of it. And I have no way to log where the error may be originating from, as it is occurring when loading the module into the server script. And I know that's what's happening because this occurs regardless of the operation type and the scripts I create always have a condition to check for specific operation types before getting into the nitty gritty. For example, if I have it checking for a "print" operation, but the record is opened to "edit". I even have the entire function wrapped inside of a try/catch block.</p>
  
  <p>I haven't had much luck in tracing the cause of these issues down, so I'm hoping that both isues stem from the same cause.</p>