I am getting an error when trying to create a version of my unlocked package after adding Apex code that references the Account.BillingCountryCode and Account.BillingStateCode fields. Everything is working properly in my scratch org with State and Country Picklists enabled and my DevHub org also has State and Country Picklists enabled.
When I try to create the unlocked package version, this is the error I receive:
AccountTriggerTest: Field does not exist: BillingCountryCode on Account
AccountTriggerTest: Field does not exist: BillingStateCode on Account
Does anyone have any ideas of how to remedy this other than using Sobject.get() and Database.query instead of SOQL to that the field names are strings rather than direct references?