Dev.to
7/3/2026

What I learned about Astro 5 glob loader path resolution in a pnpm monorepo
Short summary
Astro 5's glob loader resolves relative paths from process.cwd() at build time, causing collections to silently return empty in CI builds with different working directories than local development. Use import.meta.url and fileURLToPath() to resolve paths relative to the config file, ensuring consistent behavior across all environments. Also guard against slug field overrides that can silently break content-to-page associations.
- •Glob loader path resolution differs between local builds and monorepo CI when working directory changes
- •Use import.meta.url pattern to resolve relative to config file, not process.cwd()
- •Silent failures (empty collections) go unnoticed without explicit assertions during build
Generated with AI, which can make mistakes.
Is this a good recommendation for you?


