1/2 pound thickly sliced pancetta, cut crosswise into 1/4-inch strips
2 small red onions, sliced 1/4 inch thick
1/4 cup drained oil-packed sun-dried tomatoes, cut into strips
2 tablespoons very finely chopped garlic
1/4 cup shredded basil
Salt and freshly ground pepper
1 pound spaghetti
Freshly grated Parmesan cheese, for serving
Heat 2 tablespoons of the olive oil in a large skillet. Add the pancetta and cook over moderate heat until softened but not browned, about 3 minutes. Using a slotted spoon, transfer the pancetta to a plate.
Pour off all but 2 tablespoons of fat from the skillet. Add the remaining 2 tablespoons of olive oil and heat until shimmering. Add the onions and cook over moderately high heat until just beginning to brown, about 5 minutes. Add the pancetta and sun-dried tomatoes and cook over moderate heat for 5 minutes longer. Add the garlic and cook until fragrant, about 1 minute. Add the basil and season with salt and pepper.
Meanwhile, in a pot of boiling salted water, cook the spaghetti until al dente. Drain the spaghetti, reserving 1/2 cup of the cooking water. Add the spaghetti to the skillet along with 1/4 cup of the cooking water and toss over moderate heat until combined. Transfer to a bowl and serve, passing the Parmesan at the table.