title: Passing String to Import Function React
body: <p>I'm trying to create a helper method to lazily import modules with a delay in react.</p>
  
  <p>This first version, when I have the path in the import fixed, it works:</p>
  
  <pre><code>import { lazy } from 'react';
  
  export function lazyLoaderWithDealy() {
    return lazy(async () =&gt; {
      const [moduleExports] = await Promise.all([
        import('components/SchemaEditor'),
        new Promise(resolve =&gt; setTimeout(resolve, 300))
      ]);
      return moduleExports;
    });
  }
  </code></pre>
  
  <p>But in this second example, when the path to the module comes from a variable, it doesn't work, any idea why?</p>
  
  <pre><code>import { lazy } from 'react';
  
  export function lazyLoaderWithDealy(path) {
    return lazy(async () =&gt; {
      const [moduleExports] = await Promise.all([
        import(path),
        new Promise(resolve =&gt; setTimeout(resolve, 300))
      ]);
      return moduleExports;
    });
  }
  </code></pre>