hotfix: lazy icon dev performance

This commit is contained in:
zomars committed 2024-04-03 22:14:30 -07:00
1 parent d30fb213d2
commit 986d196a37
1 file changed
+5 -7
+5 -7
View File
@@ -10,15 +10,13 @@ interface IconProps extends Omit<LucideProps, "ref"> {
name: IconName;
}
const IconDev = dynamic(() => import("./IconDev"));
const IconProd = dynamic(() => import("./IconProd"));
const Icon = memo((props: IconProps) => {
const IconLazy = dynamic(
// Fast refresh doesn't play nice with dynamic imports
// This prevent slowdowns in development mode
if (process.env.NODE_ENV === "development") return <IconDev {...props} />;
return <IconProd {...props} />;
});
process.env.NODE_ENV === "production" ? () => import("./IconProd") : () => import("./IconDev")
);
const Icon = memo((props: IconProps) => <IconLazy {...props} />);
Icon.displayName = "Icon";