Should Start docs document that import.meta.dirname changes during prerender? #7518
allohamora
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I ran into a confusing path-resolution issue with TanStack Start + Nitro prerendering.
In server code, I used
import.meta.dirnameto resolve a project-relative directory:This works in the dev environment, but during prerendering, the module is executed from the built server output (
.output/server/_ssr), soimport.meta.dirnameno longer points to the expected path.This could be fixed by resolving with
process.cwd():Should the Static Prerendering docs mention that server code executed during prerendering runs from generated output, so
import.meta.dirnameshould not be assumed to refer to the original file path?Beta Was this translation helpful? Give feedback.
All reactions