Reputation: 451
Using nextjs 14.2.5, in one of the server component, I need to save a temp file to server storage, the code works fine, but every time the server component is called, there's the this warning
lint TP1004 fs.existsSync(???0) is very dynamic
recorded in the log, how can I get rid of this warning?
Upvotes: 1
Views: 156
Reputation: 1531
Unfortunately, there is no way to fix that except to upgrade Next.js to v15.x or no use turbopack...
The more details:
If you can't do that, you can try to add an empty string like '' to the input parameter. For me, that worked, and the lint tips were all gone.
// before
const stats = statSync(path);
// after
const stats = statSync(path || '');
Upvotes: 0