title: Using webpack's `require.context` with angular cli and ivy
body: <p>We're trying to port an angular application that was built without the angular cli (uses webpack directly and a custom server) to angular 9 with cli. The upgrade to angular 9 itself worked perfectly. After we started using the angular cli, we faced several problems.</p>
  
  <p>The only one remaining right now is that it seems the build is not picking up webpack's <code>require.context</code> calls at all. We use this everywhere to find and register our components dynamically, and it used to work just fine before, using only the <code>@types/webpack-env</code> package. But now, in vscode, there are no syntax errors, but when we try to run <code>ng serve</code>, it produces the following error for each file that has <code>require.context</code>:</p>
  
  <pre><code>ERROR in src/app/shared/shared.module.ts:22:29 - error TS2339: Property 'context' does not exist on type 'NodeRequire'.
  
  const requireFile = require.context(
  </code></pre>
  
  <p>And the whole build fails. I'm guessing this is because of ivy in some way, but I don't know how to approach this, I looked everywhere but I didn't find a solution. I tried to install <code>@types/webpack-env</code> in dependencies (instead of dev dependencies), but no luck. I'm not sure why this is happening, I thought that webpack will work normally and pick up those calls before ivy gets to work.</p>