#Built-in method for listing directories
13 messages · Page 1 of 1 (latest)
Hi. Could you try uninstalling fs? Fs is a native module in nodejs and should not need installing. It might actually make the default fs package inaccessible
Also, how exactly did you install fs? npmjs.com doesn’t even list it as a package
I just did npm install fs and the module was added
However I still don't know where I should import it from. Within the .astro file I want to use it in or in astro.config.mjs?
Also is it possible to use Astro.glob() for listing directories?
Uninstalling it didn't solve the issue unfortunately
why do you need access to the file system? You might have an easier time using astro's built in functionality.
Cause I wanted to automate the creation of pages from directory names which hosted links towards the actual sub-collection content. As of now, I still don't know or can't figure out any built-in function or technique to do that, so I did it the ugly way.
The smart way would have probably been to generate a "tree" of some sort and iterate through it to generate each page
not exactly sure what you mean by "hosted links", but are you using Astro content collections? https://docs.astro.build/en/guides/content-collections/
I meant featured or contained links, but yes I am using Astro content collections