I have found the answer, but I am interesting is there any doc about this?
In DUB, how do I conditionally compile code based on optional dependencies?
Daniel Kozak via Digitalmars-d-learn Wed, 16 Aug 2017 14:06:12 -0700
There is a question on SO:
https://stackoverflow.com/questions/45697469/in-dub-how-do-i-conditionally-compile-code-based-on-optional-dependencies