title: Is is possible to include a source file in nodejs+puppeteer to add functions?
body: <p>I know </p>
  
  <pre><code>await page.evaluateOnNewDocument(fs.readFileSync('./helperFunctions.js', 'utf8'));
  </code></pre>
  
  <p>to add functions to <code>evaluate()</code> context, that is very handy.</p>
  
  <p>But is anyone can provide any example to have the same on the main context ? By example, said I want to add a </p>
  
  <pre><code>page.existsText()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>existsText()
  </code></pre>
  
  <p>function with this code <strong>from a file to be included/sourced</strong> :</p>
  
  <pre><code>existsText = (string) =&gt; {
      // code goes here
  }
  </code></pre>
  
  <p>What is the way to go ?</p>