drupalSettings object not showing for anonymous users. core/drupalSettings is added as a library dependency I'm stumped on this one. I’m having an issue where the drupalSettings object is empty when not logged in. Works fine when I am authenticated. - core/drupalSettings is in theme’s *.libraries.yml file.

I've tried


Cleared cache (1million times).
Triple checked the YAML indentation
Verified that the settings are being added when stepping through via Xdebug
The JS file that I'm adding is via ['# attached'] works great


What am I missing here? Where to start troubleshooting? I'll owe  if someone can help point me in the right direction. 

themename.libraries.yml

views-load-more:
  js:
    js/views-load-more.js: {}
  dependencies:
    - core/drupalSettings


In my themename.theme

function themename_preprocess_views_view(&amp;$variables) {
  if (!empty($variables["pager"])) {
    $view_selector = '.view-' . $variables["id"] . '.view-display-id-' . $variables["display_id"];
    $view_content_selector = $view_selector . ' .view-content';
    $view_pager_selector = $view_selector . ' .pager';

    $variables["view_array"]["#attached"]["library"][] = 'themename/views-load-more';
    $variables["view_array"]['#attached']['drupalSettings']['themename']['viewsLoadMore']['viewSelector'] = $view_selector;
    $variables["view_array"]['#attached']['drupalSettings']['themename']['viewsLoadMore']['viewContentSelector'] = $view_content_selector;
    $variables["view_array"]['#attached']['drupalSettings']['themename']['viewsLoadMore']['viewPagerSelector'] = $view_pager_selector;
  }
}


Note that the themename/views-load-morelibrary does get attached when anonymous (I can see the JS file within it).

And also note that this works perfectly when authenticated. This tells me that the drupalSettings dependency isn't working even though I'm declaring this.

How do I troubleshoot this?
Solved the issue... and the answer is weird...

within the html.html.twig file, we have a &lt;div class="body-inner"&gt; tag that wrapped the &lt;js-bottom-placeholder token="{{ placeholder_token }}"&gt; placeholder.

For whatever #drupalWTF reason, if this placeholder tag is wrapped inside of a div, drupalSettings will load an empty object. Once I moved it directly underneath the body tag, it worked fine. 

Hope this helps someone!