Preheat oven to 350°F (175°C) and grease a 9x13-inch baking pan
Mix dry ingredients – In a large bowl, whisk together flour, sugar, baking soda, and salt
Add wet ingredients – Stir in eggs, vanilla, and crushed pineapple (with juice). Mix until well combined.
Fold in nuts (if using) and pour batter into the prepared baking pan.
Bake for 30-35 minutes or until a toothpick inserted in the center comes out clean. Let cool completely
Prepare the frosting – Beat cream cheese and butter until smooth. Add powdered sugar and vanilla, mixing until creamy.
– Frost the cake and sprinkle with shredded coconut if desired. – Chill for 30 minutes before serving for the best flavor