If there is no gravity in space.
How can they use gravity to throw bombs into the Dreadnought in the first scene on the movie?
A recent tweet from the head of the Star Wars Story Group, Pablo Hidalgo would suggest that (artificial) gravity plays its part in getting the bombs out of the magazine.
There's gravity on the bomber. We saw a person fall and a remote control fall. That's really all you need to get the bombs to fall out the bottom and then keep falling.
The Last Jedi: The Visual Dictionary indicates however that the bombs are repulsed from the rack by electro-magnetism (like a rail gun) and then drawn to their metal target by magnetic attraction.
Bombs don't technically "drop" in microgravity, but are impelled from their racks by sequenced electromagnetic plates in the clip. The bombs are then drawn magnetically to their unfortunate targets.
We can square this circle by imagining that the lowest bombs (which only fall a few metres in gravity) are given an additional boost by the magnets, in order to get them moving fast enough that the topmost bombs (which fall 20+ meters) don't end up ploughing into them.
It looked like they used inertia. The bomber has gravity inside it (which was a minor plot point, with the pilot falling and then knocking the remote down). They hit the release and whatever gravity it uses pulls the bombs out. Since there's no air in space, the bombs simply continue on their trajectory until they hit something.
As well as having some kind of artificial gravity on the bomber, there were other sources of gravity-like forces.
The battle was over a planet, but it's not clear if the ships were in orbit of it. They could have been falling towards it.
The First Order dreadnaught also had artificial gravity inside, and it's not clear how far outside that extends. Certainly Poe Dameron didn't seem to be experiencing zero gravity effects inside his ship from what we could see, although it too may have had a gravity generator of some kind.