With no --target, esbuild assumes the output runs somewhere that supports everything it was given and passes modern syntax straight through: optional chaining, class fields, top-level await, and newer operators all survive verbatim. A bundle that works in current Chrome then throws a syntax error in an older browser or an older Node.
Set the target explicitly to the oldest runtime you support, for example --target=es2020, --target=node18, or a browser list like --target=chrome109,firefox115,safari16. esbuild will downlevel what it can and will fail with a clear message for syntax it cannot lower, which is better than silently shipping it.
Downleveling is syntax only. esbuild does not inject polyfills for missing globals or methods, so Array.prototype.at on an old runtime is still a runtime error even with a low target. Polyfills remain the application's responsibility, typically via an explicit import in the entry point.