nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.08k stars 624 forks source link

Stray files in content directory, cause build to fail #2608

Open oripka opened 5 months ago

oripka commented 5 months ago

I had a stray png in the content dir and it caused by production build to fail, dev was fine.

I suggest changing this line(, to check if item is defined)

const dirConfig = db.find((item: any) => item._path === joinURL(path, '_dir'))

to

const dirConfig = db.find((item: any) => item?._path === joinURL(path, '_dir'))

https://github.com/nuxt/content/blob/f753723d3cd4d8f8a92d050b9be59489c522c35f/src/runtime/query/match/pipeline.ts#L79

farnabaz commented 3 months ago

Do you still have issue in latest version? If so, could you provide a simple reproduction using nuxt.new/s/content