Preheat oven to 350 degrees. Grease a 9x13 inch baking pan.
Mix the batter: Whisk flour, sugar, baking soda, and salt in a large bowl. Add eggs, vanilla, and the entire undrained can of crushed pineapple. Stir until smooth. Fold in nuts and coconut if using.
Bake: Pour batter into the prepared pan and spread evenly. Bake 30 to 35 minutes until golden and a toothpick comes out clean.
Cool: Let the cake cool completely in the pan, at least 45 minutes to 1 hour, before frosting.
Make the frosting: Beat cream cheese and butter until smooth. Add powdered sugar gradually. Mix in vanilla and cream one tablespoon at a time until spreadable.
Frost and chill: Spread frosting over the cooled cake. Refrigerate at least 30 minutes before slicing and serving.