Can I Configure Rust Analyzer & VSCode to Use a Different Target For Different Crates in My Workspce?

This is because, unfortunately, .cargo/config.toml is not a configuration file for a package. It's a configuration file that sets the behavior of running cargo commands. So, my_wasm/.cargo/config.toml applies when you run cargo commands while in the my_wasm/ directory, and not otherwise — regardless of what packages those cargo commands are operating on.

So, it will generally not get you what you want to use .cargo/config.toml for a single package in a workspace, and, in general, .cargo/config.toml is not a fully reliable way of setting any build settings (e.g. cargo --manifest-path=/path/to/some-project/Cargo.toml from an unrelated working directory will ignore it entirely, I believe).

Cargo’s unstable feature per-package-target will let you declare that the specific package should be compiled for wasm regardless of the rest of the workspace.

Outside of unstable features, the only option is not put both packages in one workspace. You can use rust-analyzer.linkedProjects to have rust-analyzer check both packages/workspaces simultaneously, and in that case, the .cargo/config.toml for each will be used.