We establish improved uniform error bounds on a second-order Strang time-splitting method which is equivalent to an exponential wave integrator for the long-time dynamics of the nonlinear Klein--Gordon equation (NKGE) with weak cubic nonlinearity, whose strength is characterized by $\varepsilon^2$ with $0 < \varepsilon \leq 1$ a dimensionless parameter. Actually, when $0 < \varepsilon \ll 1$, the NKGE with $O(\varepsilon^2)$ nonlinearity and $O(1)$ initial data is equivalent to that with $O(1)$ nonlinearity and small initial data, the amplitude of which is at $O(\varepsilon)$. We begin with a semidiscretization of the NKGE by the second-order time-splitting method and derive a full-discretization by the Fourier spectral method in space. Employing the regularity compensation oscillation technique which controls the high frequency modes by the regularity of the exact solution and analyzes the low frequency modes by phase cancellation and energy method, we carry out the improved uniform error bounds at $O(\varepsilon^2\tau^2)$ and $O(h^m+\varepsilon^2\tau^2)$ for the second-order semidiscretization and full-discretization up to the long time $T_\varepsilon = T/\varepsilon^2$ with $T$ fixed, respectively. Extensions to higher-order time-splitting methods and the case of an oscillatory complex NKGE are also discussed. Finally, numerical results are provided to confirm the improved error bounds and to demonstrate that they are sharp.