Some of the Maluku Islands, which are in Eastern Indonesia, are Muslim majority but they were vital to the spice trade.
On the other hand, note South Java, which has literally only one port, became Muslim. Trade doesn't explain everything.
Certain Maluku Islands had a specific reason for not being Islamized - Ambon, for instance, was taken over by the Portuguese in the sixteenth century when Islamization of the archipelago was still underway, while the Banda Islands saw a full-scale genocide by the VOC. As a result, religion did not emerge in Maluku in the same way as it did elsewhere.
And on Java, there were overland trade networks that likely helped spread Islam, and my understanding is that in some of the Javanese interior Islam was weak enough that it has seen some Christianization. Trade doesn’t explain everything, but it explains a great deal.