title: How to import module based dependencies for firebase cloud functions?
body: <p>I want to organize my firebase cloud functions in specific files,
  and currently, I have these 3:</p>
  <ul>
  <li>index.ts</li>
  <li>crypto.ts</li>
  <li>webscrape.ts</li>
  </ul>
  <br>
  Inside of these files, I have functions that use specific dependencies that are needed nowhere else.
  <br>
  <p>For example, in crypto.ts I need the crypto-js package to encrypt some user data and store it into the database.</p>
  <p>So I am importing it like so:</p>
  <pre><code>import * as CryptoJS from &quot;crypto-js&quot;;
  </code></pre>
  <p>as advised in <a href="https://firebase.google.com/docs/functions/handle-dependencies#typescript" rel="nofollow noreferrer">https://firebase.google.com/docs/functions/handle-dependencies#typescript</a></p>
  <br>
  <p>On the other hand, when I try to import puppeteer into webscrape.ts like this:</p>
  <pre><code>import * as puppeteer from&quot;puppeteer-extra&quot;;
  </code></pre>
  <p>then calling <code>puppeteer.launch();</code> gives me an error :</p>
  <p><code>Property 'launch' does not exist on type 'typeof import(&quot;c:/Users/username/Desktop/project/firebasee/functions/node_modules/puppeteer-extra/dist/index</code>&quot;)'</p>
  <p>and it only works when I do <code>const puppeteer = require(&quot;puppeteer-extra&quot;);</code></p>
  <p>What's the difference here?</p>
  <br>
  My goal is to keep the dependencies of each functions and file/module as small as possible because I assume that this will also keep the size of each function container small (Is that even true?)
  <br>
  <br>
  I didn't want to import everything to index.ts even when I trigger a function, that doesn't use this dependency at all.
  <br>
  <br>
  <p>So what is the correct way of handling these dependencies?
  <br></p>
  <p>Thanks!</p>