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
Add the generateSitemaps function to your sitemap.ts file.
Comment out the generateSitemaps function.
Execute the build process and notice that the build does not succeed, suggesting that the build process is impacted by the commented-out code.
Current vs. Expected behavior
Expected Behavior:
Commenting out the generateSitemaps function should not impact the build process Actual Behavior:
The generateSitemaps function appears to be parsed resulting to a build error.
Provide environment information
Relavant packages:
"next": "14.0.3",
Which area(s) are affected? (Select all that apply)
Metadata Files
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered:
Akramovic
changed the title
Unexpected Execution of generateSitemaps Function When Commented Out
Unexpected Execution of generateSitemaps Function When Commented Out During Build Process
Feb 22, 2024
I have similar bug. I need this to be dynamic sitemap (it accesses database), and yet force-dynamic doesn't stop this from execution during build process.
Is there a way to fix it? It seems that now multiple-sitemaps generation will always happen in build time. I am building Fraghead.io which uses Prisma (Postgres) backend, so I do not have access to any data in build time.
Temporary fix:
I have encapsulated both functions in try {} catch {}. They will run during build time and fail silently but fortunately they will be dynamically generated in the runtime as well, making it work.
Still, would be better to not call it in build time.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/elegant-surf-z8vmmj?file=%2Fapp%2Fsitemap.ts%3A7%2C25
To Reproduce
Current vs. Expected behavior
Expected Behavior:
Commenting out the generateSitemaps function should not impact the build process
Actual Behavior:
The generateSitemaps function appears to be parsed resulting to a build error.
Provide environment information
Which area(s) are affected? (Select all that apply)
Metadata Files
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: