An Artificer or a (Cloistered) Cleric as a base. Elf Cleric20 is a simple viable archer build that's doable in core.
Sure, a Fighter-based archer can have more feats, and a Rogue-based archer can do more damage consistently - precision damage immunities aside - but Cleric means you can heal, summon, blast, and buff in addition to archery, and Artificer means you can make The Best Gear™ and buff your party with things like Bane weapons and Holy weapons in times of need. Clerics can still take craft feats if they want.