import { lazy as reactLazy } from 'react';

export const lazy = (lazyImport: () => Promise<any>) => {
  return reactLazy(async () => {
    const module = await lazyImport();

    return { default: module[Object.keys(module)[0]] };
  });
};
