  We analyze the ground-state entanglement entropy of the extended Bose-Hubbard
model with infinite-range interactions. This model describes the low-energy
dynamics of ultracold bosons tightly bound to an optical lattice and
dispersively coupled to a cavity mode. The competition between onsite repulsion
and global cavity-induced interactions leads to a rich phase diagram, which
exhibits superfluid, supersolid, and insulating (Mott and checkerboard) phases.
We use a slave-boson treatment of harmonic quantum fluctuations around the
mean-field solution and calculate the entanglement entropy across the phase
transitions. At commensurate filling, the insulator-superfluid transition is
signalled by a singularity in the area-law scaling coefficient of the
entanglement entropy, that is similar to the one reported for the standard
Bose-Hubbard model. Remarkably, at the continuous $\mathbb{Z}_2$
superfluid-to-supersolid transition we find a critical logarithmic term,
regardless of the filling. This behavior originates from the appearance of a
roton mode in the excitation and entanglement spectrum, becoming gapless at the
critical point, and it is characteristic of collective models.
