title: Importing from cjs module in esm module?
body: <p>I have a cjs module defined as:</p>
  <p><code>mycjsmodule.cjs</code></p>
  <pre><code>const mobile = {
    region: 'eu-west-1',
    ...
  }
  module.exports = mobile;
  </code></pre>
  <p>Then there is an <code>index.js</code> that tries to import from this file.</p>
  <pre><code>import mobile from './mycjsmodule.cjs';
  </code></pre>
  <p>But this returns `mycjsmodule_cjs__WEBPACK_IMPORTED_MODULE_20__.default.region is undefined!</p>
  <p>After numerous hours of searching I didn't find it yet.</p>
  <p>I tried already substituting the export in <code>mycjsmodule.cjs</code> using all of the following:</p>
  <pre><code>// module.exports = { default: mobile };
  // module.exports = mobile;
  // module.exports = { mobile };
  // exports.default = mobile;
  // export default mobile;
  </code></pre>
  <p>And tried many import :</p>
  <pre><code>// const mobile = require('./mycjsmodule.cjs');
  // import mobile from './mycjsmodule.cjs';
  // import { default as mobile } from './mycjsmodule.js';
  // const mobile = require('./mycjsmodule.cjs').default;
  </code></pre>
  <p><code>package.json</code> -&gt; type:module</p>
  <p>All of the above keep throwning the error or some other error.
  Do you know how I can import the default from cjs in an esm module?</p>
  <p>Regards,
  Nick</p>
  <p><strong>Edit</strong>
  <code>craco.config.cjs</code></p>
  <pre><code>const CracoLessPlugin = require('craco-less');
  const webpack = require('webpack');
  
  module.exports = {
    webpack: {
      plugins: {
        add: [
          new webpack.DefinePlugin({
            process: { env: {} }
          })
        ]
      }
    },
    plugins: [
      {
        plugin: CracoLessPlugin,
        options: {
          lessLoaderOptions: {
            lessOptions: {
              modifyVars: {
                '@menu-collapsed-width': '60px',
                '@layout-header-padding': '0 1em 0 0',
                '@screen-xs': '700px',
                '@table-padding-vertical': '6px',
                '@page-header-padding-vertical': '10px'
              },
              javascriptEnabled: true
            }
          }
        }
      }
    ]
  };
  </code></pre>