Select2 doesn’t work in a repeater or flexible content field

When you have select2 activated in a repeater of flexible content block, you will see a warning message above the field when you use this field.

A fix is, to save the post. After saving the post select2 will work.

We know what causes it, we just need to find a proper fix.