webGL issue in 2021.3 LTS

I’m trying to build my game for WebGL and consistently when it loads in the browser whether I compile it from Windows or Linux, I get the following error:

webGL.loader.js:1 failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #2967 failed: i32.lt_u[1] expected type i32, found i64.popcnt of type i64

When I build it with the Development flag checked, the error message shows:

wasm streaming compile failed: CompileError: WebAssembly.instantiateStreaming(): Compiling function #12886:“Enumerable_Count_TisRuntimeObject_m8989C1412265…” failed: Invalid opcode 0xff @+3061658

It works fine in the editor and compiles both for Linux and Windows fine. I’m fairly new to WebGL so apologies if there’s something obvious I’m missing. Thanks in advance.

update: after digging deeper into some forums, I tried to create a completely empty project with a new scene containing just a single GameObject to suss out whether it might be any of my code. I got a similar but slightly different error message:

test.loader.js:1 wasm streaming compile failed: CompileError: WebAssembly.instantiateStreaming(): Compiling function #7491 failed: Invalid opcode 0xff @+2382546

failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #7491 failed: Invalid opcode 0xff @+2382546