As suggested by Ihar Aliakseyenka, the “safelist” section is exactly what I was looking for. Thanks Ihar!
module.exports = {
content: [
'./pages/**/*.{html,js}'
'./components/**/*.{html,js}',
],
safelist: [
'bg-red-500',
'text-3xl',
'lg:text-4xl',
]
// ...
}