-
-
Notifications
You must be signed in to change notification settings - Fork 740
Description
Environment
- Windows 11 (8gb ram)
- Node 20
Reproduction
-
I have 300 files (json), each around 300kb in size in the
contentfolder. The app fails to start itself, i.e., onnpm run dev, the app fatally fails with javascript heap memory error -
So, I spilt these 300 files into 40 files each, so now I have around 12000 files (json), each much smaller with 7-8 kb in size. Now, the app starts properly (i.e., no error on
npm run dev. I'm able to query properly in dev, but the app fails fatally onnpm run build.
I'm using Nuxt 3 server app, i.e., Nitro Firebase preset. So, I'm using serverQueryContent in the /api/articles/index.ts file to serve my response. In this file, I'm finding all the 12000 json files, and then filtering them using normal filter function (because I want to query the files by the object keys of the same file, which is not possible with the module's query syntax). This is working properly in dev. On build, it fails.
Describe the bug
First bug (few files, but large in size)
- App fails on
npm run devitself with error of memory heap.
Second bug (many files, small in size)
-
On
npm run dev, several red warnings abouttoo many files open. But the app still starts properly. -
On
npm run build, there's a fatal error related to unstorage thaterror [unstorage] Cannot stringify value!. On inspection, I found that it is due toPromise.allsyntax in themapin the content module's code. When I changed it to simplefor... ofloop, and added a wait time of 5 ms, this stringify error went away, and the app starts building for production. But then a new fatal error props up later related to tailwind config file that too many files open.
Additional context
Can the module contributors kindly look into it? I want to add 160000 files ultimately, but the module fails at 12000 files itself. I tried removing the files, and found the module works fine (both during dev and build) with max 6000-7000 files of 7-8 kb.
Note all these files are json (object format).
Logs
No response