I am working with a collection of folders, where each folder contains an index.js file that I want to import.
modules/
├── moduleA/
│ └── index.js
└── moduleB/
└── index.js
How can I accomplish this using ESM?
Is it possible to achieve this without using fs? In CommonJS, you can use something like the following:
require('./modules/**/index.js', {mode: (base, files) => {
console.log(files)
}});