Theme app extension - JS script appended to DOM element ends with "Maximum call stack size exceeded"

Update: I narrowed the problem to the terser-webpack-plugin. When not used, everything is fine. When used, stack size is exceeded. I tried to add:

new TerserPlugin({
    terserOptions: {
        compress: {
            sequences: 2
        }
    },
}),

instead of default 200 sequences, file is slightly bigger but error still occurs. I use this plugin in latest version (5.3.10).

Can I somehow tune-up this plugin to satisfy Shopify limitations?

I’ll try other minifiers as a workaround.