You can't cond-expand a module definition because you need the module definition in order to know what names are imported, including cond-expand. Rather than wrapping define-module in cond-expand, you need an inner cond-expand. Unfortunately, Guile's define-module doesn't support a cond-expand form. Fortunately, R7RS's define-library does! So, you'd want to do something like this:
(define-library (cond-expand (hoot (import (web dom))) (else)) (export message) ...)