I notice you've already got plenty of answers about capacitors and batteries. But since we're in space, what about speed?
Speed matters, and in space, speed differences can be astronomical.
In the mid-60s during the ramp-up of NASA's Apollo program, there was a lot of research being done on the Moon. And a lot was still unknown: what was the surface really like? Was it rocky and hard, or was it so soft & dusty that a lander's legs would sink right in?
Geologists at the time were arguing about the origin of the Moon's craters. There were two competing theories, that they were formed by meteor impacts, or that they were formed by volcanic eruptions blasting holes in the surface.
Volcanists argued that when you look closely at the Moon's surface, nearly every single crater is perfectly round. In fact, it's hard to find one that's not.

So how could it be that in the chaos of space, with meteors being flung about at all different angles, that all the craters are perfectly round? There's not a single elliptical or elongated crater shape to be found.
To learn more we had to study impact craters, and meteors sometimes hit Earth too. Like Meteor Crater in Arizona. Originally this was also thought to be caused by a volcanic explosion, a fair point since the San Francisco volcanic field is only about 40 miles away.
However, meteorite fragments had been found around the rim and basin of the crater, and the theory was proposed that this was a real meteor impact site. This led Daniel Barringer on a business venture: a crater this size (>1km across) must be caused by an equally huge meteor filled with precious metals, right?

So in 1903 Barringer's mining company, the Standard Iron Company, purchased the land with the idea that due to ~30 tons of iron meteorite fragments laying about the basin, the meteor itself must be buried somewhere under the crater floor.
Barringer spent 27 years searching, but no significant iron deposits were ever found.
Where was the giant meteor? It would take several decades before science matured enough to answer.
$E=mc^2$ or, the equivalence of mass and energy
Einstein to the rescue!
This equation may be so familiar to most people by now that it's jaw-dropping, awe-inspiring everyday significance must be lost on you.
But take another moment right now to really let it soak in. This mind-bogglingly simple equation is telling us that energy and mass are equivalent. To put it another way, mass is energy.
(And energy has mass. If you stretched out a rubber band, and somehow were able to weigh it like that, the rubber band would weigh more while stretched out than it would at rest.)
Speed is also energy
And in space with nothing to slow you down, objects can get thrown around at scary-fast speeds, right? Speeds so fast we usually measure them in km/s, or kilometers per second.
So what happens when a meteor already traveling at several dozen km/s gets pulled in even faster by the Moon's gravity? It literally explodes.
To put it in technical terms, the impact force is so great it breaks apart the bonds of the atoms holding the meteor together, and all that mass gets converted to energy.
Take a look at the Moon's craters again. Yes, they're all perfectly round, but that's because each time an impactor hit, it exploded like TNT. The Moon is showing scars of literal bombardment.
Why did Daniel Barringer never find his giant meteorite? Because we wouldn't discover until later that when a meteor hits at high speed, it hits with so much force that most of its mass vaporizes into energy.
Kinetic kill weapons
The irony of weapons in space is that in space everything is a weapon.
If you have the capability to get up to orbital speed, or even faster, your vehicle itself is a weapon. If you could for example, approach the speed of light, your vehicle could easily destroy an entire planet.
You don't need bombs or warheads, any regular matter like debris or asteroids will do.
It's worth mentioning that the Chinese have already done tests like this on their own satellites. No warhead required, just a big, pointy steel rod, AKA a "kinetic kill vehicle". (Also worth noting that this test in particular did not vaporize everything, it actually scattered large pieces of debris everywhere much to the dislike of every nation with a space agency.)
The rule of cool
To answer your question, it doesn't really matter if capacitors explode when being shot at, because everything explodes if it's going fast enough! (As long as it has mass, i.e. a projectile, not a laser weapon)
Use this to your advantage when designing, or ignore it if it's not. If this is for a game most people won't notice anyways. The reality is even tiny micro-meteorites can turn into bombs if you're traveling fast through space, leaving Moon-like craters in the hull of your ship.
(You'd need auto-targeting lasers or something to handle micro-meteorites and debris while traveling fast through interstellar space.)
I hope this answer was helpful and added some things you haven't considered yet.
Cheers!