79502331

Date: 2025-03-11 23:37:42
Score: 1
Natty:
Report link

Maybe a clue in github.com/evanw/esbuild/issues/3324

From the Issue thread:

In summary, this runtime error is caused by bundling CJS libraries into ESM context (i.e. bundle express in format: 'esm'). esbuild uses closures to wrap these CJS liraries, and Node.js forbids dynamic (i.e. not at the top level) require on builtin modules.

I would still suggest you to exclude these dependencies from your bundle with --packages=external or --external:express since your runtime supports loading them from the file system, and it also bundles less code.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Moacyr Catani