The James Webb space telescope will be positioned very close to L2. According to JPL, Webb will have a large solar-array to power itself. I don't understand how this works, since L2 is positioned "behind" the earth relative to the sun.
The planned orbit for the JWST is quite a large halo orbit around Sun-Earth L2. It's very roughly elliptical, with dimensions of about +/- 350,000 km "vertically" (perpendicular to the Earth's orbital plane) and about +/- 750,000 km "horizontally" (in the Ecliptic plane).
You can see a drawings in (for example) James Webb Space Telescope Initial Mid-Course Correction Monte Carlo Implementation using Task Parallelism and also in Stationkeeping Monte Carlo Simulation for the James Webb Space Telescope, shown below. The period of the larger Sun-Earth L1 and L2 halo orbits are roughly six months, or about half of the Sun-Earth orbital period.
So the JWST won't get close enough to the Sun-Earth line to even consider the issue. But if you wanted to do the math, then yes IF the JWST was in an orbit that took it very close to the Earth-Sun line, it could get partially but very significantly eclipsed by the Earth's shadow and the light from the Sun would be dramatically reduced. It wouldn't go to zero, and so if it shut down most systems it might survive this, but it's not going to happen.
above: From here. Figure 2. A sample trajectory for the JWST observatory in the RLP frame (the Sun is located along the –x axis). The orbit of the Moon appears for scale in the top two plots. L2 is approximately 235 Earth radii (Re) from the Earth.
above: From here. Figure 1. Plots of the JWST Design Reference Mission LPO about SEM L2. The top plot gives a skew 3D view, while the bottom plot gives a view of the RLP xy-plane. The orange line in the top view is the direction of the Sun from Earth.
I've added these here because the axes are labeled in kilometers, not Re (Earth radii).
In JPL Horizons there is a sample calculation of a Halo orbit for JWST that was done in 2014. It orbits for about eleven years, and presumably includes small station-keeping maneuvers to do so. This real-world orbit is more complex than a pure CR3BP (Circular Restricted Three-body problem) halo orbit because the Earth is in an elliptical orbit around the Sun, and the Moon adds further perturbations.
The first figure below shows the complete, eleven-year orbit with it's final wander away from L2 when station keeping ends. This is a "top-down" view of the Ecliptic plane, with the Sun to the left.
The next three images are just one year's worth, showing the two loops of the six-month period halo orbit. The Blue dot is the Earth, the green torus is the Moon's orbit, and the red line is the orbit of JWST. The coordinates are in the rotating frame of the Earth-Moon barycenter around the Sun.
above: Top-down view, eleven years.
above: Top-down view, one year. (Sun to the left)
above: View from the Sun, one year.
above: View from the side, one year. (Sun to the left)