Preheat your oven to 350°F (175°C). Grease a 9x9-inch baking dish or line it with parchment paper for easy removal.
In a large mixing bowl, combine the crushed pineapple, shredded coconut, flour, sugar, baking powder, and salt. Stir until well mixed.
In a separate bowl, whisk together the melted butter, eggs, and vanilla extract until smooth.
Pour the wet ingredients into the dry ingredients and mix until just combined. If using, fold in the chopped nuts.
Pour the batter into the prepared baking dish and spread it evenly.
Bake in the preheated oven for 30-35 minutes, or until the top is golden brown and a toothpick inserted in the center comes out clean.
Allow the bake to cool in the pan for about 10 minutes before slicing into squares and serving.