Preheat your oven to 350°F (175°C). Grease a 9×13-inch baking pan and set aside.
In a large mixing bowl, whisk together the flour, granulated sugar, brown sugar, baking soda, and salt.
Add the vanilla extract, eggs, and undrained crushed pineapple to the dry ingredients. Stir until well combined. Fold in the shredded coconut if desired.
Pour the batter evenly into the prepared baking pan. Bake for 30-35 minutes or until a toothpick inserted in the center comes out clean.
Allow the cake to cool completely in the pan.
For the frosting, beat the softened cream cheese and butter together until smooth. Gradually mix in the powdered sugar and vanilla extract until fluffy.
Spread the cream cheese frosting over the cooled cake. Slice and enjoy!