From L2
L2 is about 1,000,000 miles from Earth which would mean the Earth would be as small as the Sun for an observer (31 arc minutes)....
The Earth would be far too small to block sunlight.
Besides, any satellite at L2 or L1 will orbit those points rather than remain right on them.
That's why the JWST has a sun shield.
