productbuild --distribution "$DIS_FILE" --resources "$RES_DIR" --package-path "$PKGS" --version "$VERSION" "$PKG_NAME"
And the crash stack is:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libxar.1.dylib 0x00007fff2ae2c00c xar_file_new_from_parent + 190
1 libxar.1.dylib 0x00007fff2ae29d59 xar_add_frombuffer + 63
2 com.apple.PackageKit 0x00007fff3ba79a2f -[PKMutableXARArchive setData:forPath:compressed:] + 246
3 com.apple.PackageKit 0x00007fff3babb38e -[PKArchiveDistributionContainer setResourceData:forKey:forLocalization:] + 284
4 com.apple.PackageKit 0x00007fff3bab9fef -[PKMutableDistributionContainer storeResourcesAtPath:forLocalization:] + 922
5 com.apple.PackageKit 0x00007fff3baa5590 -[PKArchiveProduct(ForMutableSubclassers) addResourceDataAtPath:] + 324
6 productbuild 0x000000010efdc8a8 0x10efd8000 + 18600
7 productbuild 0x000000010efdba6e 0x10efd8000 + 14958
8 libdyld.dylib 0x00007fff204c0f3d start + 1
While using macOS 11.6.7, xcode 12.3, and CLT 11.1