Found this on the MLB website,
9.06 Determining Value of Base Hits
Rule 9.06 Comment: The official scorer shall not credit the batter with a three-base hit when a preceding runner is put out at home plate, or would have been out but for an error. The
official scorer shall not credit the batter with a two-base hit when a preceding runner trying to advance from first base is put out at third base, or would have been out but for an error.
What I get from this is the batter would get the credit for a base hit in these scenarios.
9.06 Determining Value of Base Hits
Rule 9.06 Comment: The official scorer shall not credit the batter with a three-base hit when a preceding runner is put out at home plate, or would have been out but for an error. The
official scorer shall not credit the batter with a two-base hit when a preceding runner trying to advance from first base is put out at third base, or would have been out but for an error.
What I get from this is the batter would get the credit for a base hit in these scenarios.