Custom js added with drupal_add_js doesn't actually get added if I enable "Aggregate JavaScript files" or "Cache blocks" The site is the most stock, only Drupal 7 core is installed.
included my theme, where the page.tpl and html.tpl theme files are copied from core
I created a Yandex.Maps module, this is a block where js is added.
&lt;?php
  function yamap_block_info(): array {
    $blocks['yamap'] = [
      'info'  =&gt; 'Block Yandex.Map',
      'cache' =&gt; DRUPAL_CACHE_PER_ROLE,
    ];
    return $blocks;
  }
  
  function yamap_theme(): array {
    return [
      'main-yamap' =&gt; [
        'template' =&gt; 'yamap-block',
      ],
    ];
  }
  
  function yamap_block_view($delta = ''): array {
    if ($delta == 'yamap') {
      $module_path = drupal_get_path('module', 'yamap');
      drupal_add_js($module_path . '/src/js/yamap.js', ['scope' =&gt; 'footer', 'weight' =&gt; 40]);
      drupal_add_css($module_path . '/src/css/yamap.css');
      
      
      return [
        'content' =&gt; theme('main-yamap'),
      ];
    }
  }
?&gt;

When I enable cache and aggregation, js falls off .. there are no errors on the page and in the console.
Drupal.settings.my_data does not exist too. But, if I turn off the block cache or aggregation, then everything is ok
Is the site in D7 or D8/9?
Because in 8+ you should use  #attached instead of drupal_add_js/css