Compile Commentscript
Retina 0.8.2, 63 bytes
(//.*|/\*(.|¶)*?\*/|¶)|.
$1
//(.*)|/\*((.|¶)*?)\*/|(¶)¶*
$1$2$4

Try it online! Link includes test cases, but the newline-collapsing rule means that they're not double-separated on output. Explanation:
(//.*|/\*(.|¶)*?\*/|¶)|.
$1

Delete anything not a newline or comment.
//(.*)|/\*((.|¶)*?)\*/|(¶)¶*
$1$2$4

Keep the content of comments and one newline of consecutive newlines.