drupalSettings cached in page
Okay, I found the answer. It was as simple as adding this to $variables:

$variables['#cache']['tags'] = $config-&gt;getCacheTags();


My question is basically a duplicate of this:

How do I avoid having to clear the cache when changing a module configuration parameter?