An engine that starts slowly after sitting overnight but starts right up if it was recently running almost assuredly has a leaky check valve inside the fuel pump or fuel pressure regulator. The job of those two check valves is to keep fuel up in the fuel rail next to the fuel injectors for a fast start. When the check valve leaks, it instead lets the fuel drain back down out of the fuel injector/fuel rail area and back into the fuel tank. When that happens, it take quite a while for the fuel pump to get the fuel back up from the gas tank to the fuel rail which is what causes the slow start.
The fix is to replace the fuel pump/fuel pressure regulator assembly which requires that the gas tank be dropped... which is really not all that hard of a job.
This problem has happened to me on both of my TJs so it's not an uncommon problem. In fact, it's actually a common problem for the TJ.
A good source for the fuel pump/fuel pressure regulator assembly is www.rockauto.com
which has great pricing and fast shipments.
P.S. I used to recommend just replacing the fuel pressure regulator but now it's a toss-up on which is causing the problem, fuel pump or fuel pressure regulator, so I now just recommend replacing them both as an assembly to avoid having to do the job twice... as I did on my present TJ.