-
-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vercel/Next.js/React/Node 'too many open files' error #1446
Comments
+1 |
Solved by adding the following to // Modularize Lucide icon imports; otherwise, Vercel
// throws 'too many open files' error (https://github.com/lucide-icons/lucide/issues/1446)
// @see https://nextjs.org/docs/architecture/nextjs-compiler#using-named-imports
modularizeImports: {
'lucide-react': {
transform: 'lucide-react/{{member}}',
skipDefaultConversion: true,
preventFullImport: true,
},
}, |
Tried the I'm getting
|
My setup uses the Next.js dynamic import: import dynamic from 'next/dynamic'
import { LucideProps } from 'lucide-react'
import dynamicIconImports from 'lucide-react/dynamicIconImports'
import { FunctionComponent } from 'react'
export interface Props extends LucideProps {
name: keyof typeof dynamicIconImports
}
const SuperIcon: FunctionComponent<Props> = ({ name, ...props }) => {
const LucideIcon = dynamic(
dynamicIconImports[name],
// Loader ensures classname (with Tailwind dimensions) are set and therefore reduce CLS
{ loading: () => <div className={props?.className} aria-hidden={true} /> },
)
return <LucideIcon aria-hidden={true} {...props} />
}
export default SuperIcon |
Ah that makes sense. @leeuwd a bit tangential but the problem with the dynamic imports is that they flash on load. How are you handling that? |
This is not working, checking locally, and getting:
I am on version 0.263.1 |
I'm also getting the same error as smolak above when I try the modularizeImports fix. Using the latest versions of next and lucide-react: lucide-react: 0.263.1 It's strange because it was working fine until yesterday. |
I checked with the 0.263.0 version, and it did not work. The problem is still there. Unless some older versions did work, but I haven't checked them out. |
I can confirm that |
Hm.... interesting, let me check. I'll get back to you all once tested. |
What next.config.js confiugration are you using? modularizeImports: {
'lucide-react': {
transform: 'lucide-react/{{member}}',
skipDefaultConversion: true,
preventFullImport: true,
},
} ? Asking as this is making the app fail locally: Module not found: Can't resolve 'lucide-react/Check'
1 | import { Check, ChevronRight, Circle } from "lucide-react"; |
It works on Vercel, v0.261.0, no configuration added. But, like I mentioned in one comment, that can be just me being below the limit and the problem still being there, as locally I still compile 1000+ more components when the app is run. |
There is honestly no way that this option would ever work. The files are in some deeply nested folder which are not specified in the package.json from the lucide-react package |
Confirmed downgrading to |
Good news. NextJS PR just got merged to canary. |
But there are some problems - could you guys cooperate to get this fixed on both sides? :) Would be cool. |
Just deployed a nextjs project successfully on Vercel with version |
Prerequisites
[email protected]
,[email protected]
Step to reproduce
Installed using
yarn
, following https://github.com/lucide-icons/lucide/tree/main/packages/lucide-react#lucide-react.Error happens when all icons are imported as React Component individually, and also when all icons are imported using Next.js dynamic import.
Actual behavior
Any message or error
Error message via Vercel logs:
Client side, nothing to go on:
Resources
Update; perhaps related?
The text was updated successfully, but these errors were encountered: