Today I learned that minification in JS is a double-edged sword.

Esbuild docs

It was a weird bug, took me quite some time to figure out that problem in minification.
Stopped using terser for the same reasons.

esbuild issue