title: WEBPACK_IMPORTED_MODULE_13___default(...) is not a function
body: <p>Context : I am building a small library (let's call it myLibrary here) using TypeScript and Webpack. I built it, imported it in a react application but the react application crash.</p>
  <p><strong>Library side</strong></p>
  <p>My main entry point (index.ts) has a default export as such :</p>
  <pre><code>import wrapper from &quot;./wrapper&quot;;
  
  export default wrapper;
  </code></pre>
  <p>And my wrapper file exposes a default export which is a function (wrapper.ts) :</p>
  <pre><code>const create = () =&gt; {
    // Some functions
    return {
      init,
      close,
      getBase,
      setBase
    }
  }
  export default create;
  </code></pre>
  <p>The library pass all the unit tests easily.</p>
  <p><strong>React application side</strong></p>
  <p>After building and when importing my library in a React application, I have no Typescript error but my React app crashes with the following message :</p>
  <pre><code>TypeError: myLibrary__WEBPACK_IMPORTED_MODULE_13___default(...) is not a function
  </code></pre>
  <p>After calling my library like that :</p>
  <pre><code>import createAPI from &quot;myLibrary&quot;;
  const api = createAPI(); // Crash here even though I should have a nice object containing my functions
  </code></pre>
  <p>It's really strange as TS really compiled nicely to JS without any warnings.</p>
  <p>My library wepback config (4.43.0) which I use to build with command <code>webpack --config webpack.config.js</code>:</p>
  <pre><code>const path = require('path');
  
  module.exports = {
    mode: &quot;production&quot;,
    entry: &quot;./src/index.ts&quot;,
    output: {
      filename: &quot;index.js&quot;,
      path: path.resolve(__dirname, 'dist'),
    },
    resolve: {
      extensions: [&quot;.ts&quot;, &quot;.js&quot;]
    },
    module: {
      rules: [
        { test: /\.tsx?$/, loader: &quot;ts-loader&quot; }
      ]
    }
  }
  </code></pre>
  <p>My library TS config (3.7.3) :</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;dist&quot;,
      &quot;target&quot;: &quot;es5&quot;,
      &quot;module&quot;: &quot;CommonJS&quot;,
      &quot;lib&quot;: [&quot;dom&quot;, &quot;dom.iterable&quot;, &quot;esnext&quot;],
      &quot;sourceMap&quot;: true,
      &quot;allowJs&quot;: true,
      &quot;jsx&quot;: &quot;preserve&quot;,
      &quot;declaration&quot;: true,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;forceConsistentCasingInFileNames&quot;: true,
      &quot;esModuleInterop&quot;: true,
      &quot;allowSyntheticDefaultImports&quot;: true,
      &quot;experimentalDecorators&quot;: true
    },
    &quot;include&quot;: [&quot;src&quot;]
  }
  
  </code></pre>
  <p>Any help would be greatly appreciated :)</p>
  <p>EDIT :
  After updating default export to named export :</p>
  <pre><code>import { createAPI } from &quot;myLibrary&quot;;
  const api = createAPI();
  </code></pre>
  <p>I got a new error</p>
  <pre><code>TypeError: Object(...) is not a function
  </code></pre>
  <p>And when I try to <code>console.log(typeof createAPI);</code> I got an undefined, which should not be possible as my tests are passing and TS doesn't complain.</p>