Preheat oven to 350F (180C). Grease a 9 inch (23cm) pan and line with parchment paper.
In a small saucepan melt butter over low heat, add sugar and cook until sugar dissolves . Pour the mixture in the prepared pan and arrange the pineapple slices. Set aside until you prepare the chocolate cake.
In a medium bowl combine the flour, cocoa powder, shredded coconut, baking powder and salt.
In another bowl mix the butter and sugar until thick and creamy. Add eggs, one at a time, coconut extract and mix to combine.
With the mixer on low, alternate adding gradually flour mixture and coconut milk until all is well incorporated.
Add the melted chocolate and mix to incorporate.
Bake for 40-45 minutes or until a toothpick inserted into the center comes out with a few crumbs.
Let it cool in the pan for few minutes minutes, then invert onto a serving platter.
Serve slightly warm with a big scoop of ice cream on top. Enjoy!