4 ms·
import someModule from "module-name" const someInitializedModule = someModule(someOptions) A bit longer, but meh… const app = express(); app.use("
by wereHamster 5y ago
import someModule from "module-name"
const someInitializedModule = someModule(someOptions)
A bit longer, but meh…
const app = express();
app.use("/users", (await import("./routers/users")).default);
top-level await is a thing now
Actually, the first example could be rewritten as
const someInitializedModule = (await import("module-name")).default(someOptions);
That «simply not possible» statement is simply not true
- presentation 5y agoOr don’t even bother with the awaited import and instead import it at the top of the file, I fail to see why this is even an issue lol