How to strip all symbols from unused target?

So I have 2 Swift target in 2 package, it looks like this:

        .library(
            name: "MailKit",
            type: .static,
            targets: ["MailKit"]
        )
....
        .target(
            name: "MockKit"
        ),
        .target(
            name: "MailKit",
            dependencies: [
                "MockKit",
            ],
        ),

However, MockKit is only used for SwiftUI previews, so I don't want to include any related content in the release version.

But no matter how I try, as long as I add “MockKit” to the dependencies, the public class/function in MockKit will be compiled into .a, I checked it with otool -L .

I tried adding
-Xswiftc -whole-module-optimization -Xswiftc -disable-reflection-metadata
to swift build but it didn't work.

Anyone know how to fix it?