Probably because constants.php is included before the library defining base_url() is.
I don't know CI, but look if there is any chance to define the constant at a later point in the program flow. A CI expert may be able to tell you in more detail where exactly.