I've seen another work around to detect whether or not a file is being byte-compiled in use-package: (bound-and-true-p byte-compile-current-file).
It seems to work, as illustrated by this example:
(message
(eval-when-compile
(if (bound-and-true-p byte-compile-current-file)
"I'm being byte-compiled!"
"I'm being evaluated :(")))
When I byte compile that and then evaluate
(progn
(load-file "~/byte-compile-test.elc")
(load-file "~/byte-compile-test.el"))
It prints out
Loading /Users/jake.waksbaum/byte-compile-test.elc...
I’m being byte-compiled!
Loading /Users/jake.waksbaum/byte-compile-test.elc...done
Loading /Users/jake.waksbaum/byte-compile-test.el (source)...
I’m being evaluated :(
Loading /Users/jake.waksbaum/byte-compile-test.el (source)...done
t