I recommend selecting Swift SDKs by their IDs per swift sdk list output and not triple, as both Swift SDKs (embedded and non-embedded) use the same triple. This command would work for any toolchain version, assuming you have jq installed:
swift build --swift-sdk \
"$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm"
For Embedded Swift use the corresponding suffix:
swift build --swift-sdk \
"$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm-embedded"