  We present the galaxy stellar mass - size relation in the rest-frame near-IR
($1.5~\mu{\text{m}}$) and its evolution with redshift up to $z=2.5$. S\'ersic
profiles are measured for $\sim$ $26\,000$ galaxies with stellar masses
$M_\star > 10^9~{\text{M}}_\odot$ from JWST/NIRCam F277W and F444W imaging
provided by the COSMOS-WEB and PRIMER surveys, using coordinates, redshifts,
colors and stellar mass estimates from the COSMOS2020 catalog. The new
rest-frame near-IR effective radii are generally smaller than previously
measured rest-frame optical sizes, on average by 0.14~dex, with no significant
dependence on redshift. For quiescent galaxies this size offset does not depend
on stellar mass, but for star-forming galaxies the offset increases from
-0.1~dex at $M_\star = 10^{9.5}~{\text{M}}_\odot$ to -0.25~dex at $M_\star >
10^{11}~{\text{M}}_\odot$. That is, we find that the near-IR stellar mass -
size relation for star-forming galaxies is flatter in the rest-frame near-IR
than in the rest-frame optical at all redshifts $0.5<z<2.5$. The general pace
of size evolution is the same in the near-IR as previously demonstrated in the
optical, with slower evolution ($R_{\text{e}} \propto (1+z)^{-0.7}$) for
$L^*$~star-forming galaxies and faster evolution ($R_{\text{e}} \propto
(1+z)^{-1.3}$) for $L^*$~quiescent galaxies. Massive
($M_\star>10^{11}~{\text{M}}_\odot$) star-forming galaxies evolve in size
almost as fast as quiescent galaxies. Low-mass
($M_\star<10^{10}~{\text{M}}_\odot$)~quiescent galaxies evolve as slow as
star-forming galaxies. Our main conclusion is that the size evolution narrative
as it has emerged over the past two decades does not radically change when
accessing with JWST the rest-frame near-IR, a better proxy of the underlying
stellar mass distribution.
