it wasn't a problem with Express, but an issue with my coding style. Because I don't use semicolons the error ocurred.
app.use(...)
(async () => {
...
})()
The code gets transpiled as the app.use(...) returns a fn, that the async fn will init, so what I did was adding a semicolon before the async fn so the code would look like this:
app.use(...)
;(async () => {
...
})()