In some cases some 3rd-party apps cannot be optimized as the code is sourced from the vendor and therefore I have a limited scope of feasible options. For these I can either exclude them from the optimization if they are incompatible, or I can try to work around them.
For complicated apps with many features, it's often best to just accept the cost of performance degradation for the gain of the functionality. Although for simple apps that just add a graphic option and can be replaced by native code, I will highlight these and convert the features over so that they are theme based and written in Liquid and vanilla Javascript / HTML.