Preheat your oven to 200℃ (180C fan forced). Add the tomatoes, onions, and garlic to a large roasting tray. Drizzle over the olive oil and balsamic vinegar, then sprinkle over the brown sugar, paprika, oregano, salt, pepper, and chilli flakes. Toss everything well so it is evenly coated.
Roast for 40 to 45 minutes, until the vegetables are soft, lightly charred, and liquid has formed in the tray.
Remove from the oven and allow to cool slightly, or completely if preferred.
Transfer everything to a food processor, Thermomix, or blender. Add the fresh basil if using, then blend to your desired consistency.
Divide between containers, jars, or freezer trays and use as needed.