I'm writing a React app using create-react-app
.
Since I can do:
import LocalClass from "./localfolder/LocalClass.js"
and even (using dynamic import):
import('./localfolder/LocalClass.js').then((module) => { /* ... */ })
is there a way to list localfolder
contents, so I can dynamically import the contained files?
The listing should happen at compile or bundling time, not at runtime (I'm thinking about an automatic menu creation feature).
The folder may contain plain classes too (i.e. not React components); I guess this is a matter of the bundler, but I'm not sure.