title: Trouble transforming esm files in jest with ts-jest
body: <p>So I have been banging my head on how to get these jest code transforms to work and I have made a bit of progress with transforming the <code>spin.js</code> esm files. With that error gone I moved on to the next one which was <code>angular-instantsearch</code> but specifically <code>angular-instantsearch/node\_modules/instantsearch.js</code>. Here is the error I am reciving:</p>
  <pre class="lang-sh prettyprint-override"><code>.../node_modules/angular-instantsearch/node_modules/instantsearch.js/es/index.js:2
  import algoliasearchHelper from 'algoliasearch-helper';
  ^^^^^^
  
  SyntaxError: Cannot use import statement outside a module
  </code></pre>
  <p>Here is my base jest config that deals with the transforms:</p>
  <pre class="lang-js prettyprint-override"><code>const nxPreset = require('@nrwl/jest/preset');
  module.exports = {
    ...nxPreset,
    testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
    transform: {
      '^.+\\.(ts|js|html)$': 'ts-jest',
    },
    resolver: '@nrwl/jest/plugins/resolver',
    moduleFileExtensions: ['ts', 'js', 'html'],
    coverageReporters: ['html'],
    transformIgnorePatterns: [
      'node_modules/(?!(spin\\.js|instantsearch\\.js/es)/)',
    ],
    // this caused issues with detecting modules from component files in angular
    /* moduleNameMapper: {
      &quot;instantsearch\\.js/es$&quot;: &quot;instantsearch.js/cjs&quot;,
      &quot;instantsearch\\.js/es/(.*)$&quot;: &quot;instantsearch.js/cjs/$1&quot;,
    } */
  };
  </code></pre>
  <p>Any help on this will be extremely appreciated, thanks!</p>