Rinse the rice with cold water. Drain completely, shaking off any excess water.
In a large (about 3 quart) saucepan with a cover or the bowl of your rice cooker, melt the butter over medium heat. Add the onion and cook until soft and transparent, 1 to 2 minutes, keeping the heat low so it won't brown. Add the garlic, ginger, salt and pepper.
Add the rice and stir to coat with the melted butter. Cook, stirring with a wooden spoon, over medium heat. Cook for 2 minutes.
Add the water or stock, lime juice, chilis and bay leaf. Cover and gently simmer over low heat for about 20 minutes (or turn on the rice cooker). It's done when all the stock is absorbed and the grains of rice are tender but still chewy. If you want the grains to be softer, add a bit more stock and cook for a few minutes longer until it reaches your desired texture.
Fluff the rice with a fork and remove the bay leaf and chili. Season as needed.