Why isn't this module library loaded? I am using the following code. 

wk_elastic.info.yml

name: Blablabla
description: Blablabla
package: BlaBlaBla

type: module
core: 8.x

libraries:
  - wk_elastic/list-js

dependencies:
  - block


wk_elastic.libraries.yml

list-js:
  js:
    js/list.js: {}
  dependencies:
    - core/jquery


wk_elastic.module

function wk_elastic_preprocess_page(&amp;$variables) {
  $variables['#attached']['library'][] = 'wk_elastic/list-js';
}


The library is not being loaded.

What can I do to fix this?
Switch the active theme to a core theme. If the library loads now then make sure that your custom theme has &lt;js-bottom-placeholder token="{{ placeholder_token }}"&gt; and  &lt;js-placeholder token="{{ placeholder_token }}"&gt; in the html.html.twig template.

Another pitfall is an incorrect reference to the library. Although it does not apply to the original question I'll state it anyway because it solved the problem for me. If your my_module.libraries.yml looks like this

my_libraries.my-library:
  js: ...


then you have to use 

['#attached']['library'][] = ['my_module/my_libraries.my-library']


instead of 

['#attached']['library'][] = ['my_libraries.my-library']