I’m writing some code that should load all modules inside a folder.
for (let path of controllerPaths) {
path = path.replaceAll("\", "/"); // Replace windows path backslashes
const controller: ApiController = (await import(`file:///${path}`))?.default; // Application exits without any error
// ...
}
Wrapping the code in a try/catch block doesn’t change the result as the application still exits.
I’m sure the path is correct and exists. The path is absolute.