Custom module javascript Drupal.behaviours doesn't seems to load
When attached make sure to use the correct name of the "library"

Inside your mymodule.libraries.yml file.  The first line is your library name.

I use a different name inside my library file, and I attached a wrong library name.

 function mymodule_preprocess_block(&amp;variables){
     $variables['#attached']['library'][] = 
      'mymodule/mylibraryname';
 }


My library file mymodule.libraries.yml

mylibraryname:
  js:
    js/promotional-overlay-block.js: {}
  dependencies:
    - core/jquery
    - core/jquery.once
    - core/drupalSettings