Use wasm for all production build profile builds
There are some builds of solc that produce subtly different bytecode depending on the platform they are running on. When running under the production build profile, we should force compilation through the wasm version of solc to isolate us from the underlying platform.
In the light of https://github.com/NomicFoundation/hardhat/issues/6336, this might not always be possible.
In particular, the solcjs-wrapper stores the compiler output from solcjs as a string, and so does our solcjs-runner. For very large codebases, the string containing the compiler output might exceed the maximum string length.
https://github.com/NomicFoundation/hardhat/blob/942d9afd569f8c9b207fd514c0c64c17a6c61b8c/v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.ts#L31
This is not a problem for the native compilers because we now handle their outputs as streams instead - https://github.com/NomicFoundation/hardhat/pull/6411
Add config(?) for selecting wasm as the compiler
Let's add a preferWasm to SingleVersionSolcUserConfig, MultiVersionSolcUserConfig and SolidityBuildProfileConfig.
Re @galargh's comment: the production build doesn't merge compilation jobs, so we won't hit that error.