The first measurements of the production of muons and electrons from heavy-flavour hadron decays in Xe–Xe collisions at sNN=5.44 TeV, using the ALICE detector at the LHC, are reported. The measurement of the nuclear modification factor RAA is performed as a function of transverse momentum pT in several centrality classes at forward rapidity (2.5<y<4) and midrapidity (|y|<0.8) for muons and electrons from heavy-flavour hadron decays, respectively. A suppression by a factor up to about 2.5 compared to the binary-scaled pp reference is observed in central collisions at both central and forward rapidities. The RAA of muons from heavy-flavour hadron decays is compared to previous measurements in Pb–Pb collisions at sNN=5.02 TeV. When the nuclear modification factors are compared in the centrality classes 0–10% for Xe–Xe collisions and 10–20% for Pb–Pb collisions, which have similar charged-particle multiplicity density, a similar suppression, with RAA∼0.4 in the pT interval 4<pT<8 GeV/c, is observed. The comparison of the measured RAA values in the two collision systems brings new insights on the properties of the quark-gluon plasma by investigating the system-size and geometry dependence of medium-induced parton energy loss. The results of muons and electrons from heavy-flavour hadron decays provide new constraints to model calculations.