A heterocyclic compound which is an inhibitor of FGFR4 (fibroblast growth factor receptor 4) is described. Specifically, a compound represented by the following formula (I), including an isomer (enantiomer or diastereomer) which may be present, or a pharmaceutically acceptable salt thereof, prodrugs, deuterated derivatives, hydrates, solvates, are described. The definition of each group in the formula (I) is as described in the specification. The compounds have FGFR4 inhibitory activity and can be used for the prevention or treatment of diseases associated with FGFR4 activity or expression, and can also be used in combination with other drugs for the treatment of various related diseases, as described.