You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example in the guide to load a static file in Next.js won't work when it's deployed to Vercel, respectively in a serverless environment where output: 'standalone' is used. It works when running a non-standalone output, but I'd expect that the Guide shows a usage which is compatible with Vercel as a hoster.
Loading a static file seems to require path.join() to be used in conjunction with process.cwd(). When joining the path yourself (like it's done in the Guide with a simple string concatenation), the file is not included in the standalone output.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Page to Investigate
https://vercel.com/guides/loading-static-file-nextjs-api-route
Steps to Reproduce
The example in the guide to load a static file in Next.js won't work when it's deployed to Vercel, respectively in a serverless environment where
output: 'standalone'
is used. It works when running a non-standalone output, but I'd expect that the Guide shows a usage which is compatible with Vercel as a hoster.Loading a static file seems to require
path.join()
to be used in conjunction withprocess.cwd()
. When joining the path yourself (like it's done in the Guide with a simple string concatenation), the file is not included in the standalone output.Specifically this code block:
...must be this:
Beta Was this translation helpful? Give feedback.
All reactions