Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

We have had top-level await for a while now. I don’t know what’s so horrible about this:

  const app = express()
  app.use("/users", await import("./routers/users"))
…if you’re so inclined to do things exactly as you did in the past. I’m pretty sure bundlers will even transform that into an ordinary module import.

The cases where you actually need dynamic imports are few and far between. Are we actually talking about engine limitations here, or is it just a few snowflakes that insist on creating loggers like this?

  require("debug")("acme")
What is so particularly pretty about that is beyond me.

> ESM import runs side effects as well.

At runtime, yes. Not during static analysis.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: