Javascript file is being included but console.log wont work So I THINK I have configured my javascript right in that i want to inlude two files. leaflet.js and mappingsource.js and currently on the page source there exists this:
&lt;script type=&quot;application/json&quot; data-drupal-selector=&quot;drupal-settings-json&quot;&gt;{&quot;path&quot;:{&quot;baseUrl&quot;:&quot;\/web\/&quot;,&quot;scriptPath&quot;:null,&quot;pathPrefix&quot;:&quot;&quot;,&quot;currentPath&quot;:&quot;hello\/world&quot;,&quot;currentPathIsAdmin&quot;:false,&quot;isFront&quot;:false,&quot;currentLanguage&quot;:&quot;en&quot;},&quot;pluralDelimiter&quot;:&quot;\u0003&quot;,&quot;suppressDeprecationErrors&quot;:true,&quot;ajaxPageState&quot;:{&quot;libraries&quot;:&quot;bartik\/global-styling,big_pipe\/big_pipe,classy\/base,classy\/messages,contextual\/drupal.contextual-links,contextual\/drupal.contextual-toolbar,core\/drupal.active-link,core\/html5shiv,core\/normalize,helloworld\/leaflet,helloworld\/mappingsource,quickedit\/quickedit,shortcut\/drupal.shortcut,system\/base,toolbar\/toolbar,toolbar\/toolbar.escapeAdmin,tour\/tour,user\/drupal.user.icons&quot;,&quot;theme&quot;:&quot;bartik&quot;,&quot;theme_token&quot;:null},&quot;ajaxTrustedUrl&quot;:{&quot;\/web\/search\/node&quot;:true},&quot;bigPipePlaceholderIds&quot;:{&quot;callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages\u0026args%5B0%5D\u0026token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA&quot;:true,&quot;callback=user.toolbar_link_builder%3ArenderToolbarLinks\u0026\u0026token=xssKdKFVFD7N0FUPPcC1C7LrqMHpQFVzUhrI4cOeEgs&quot;:true,&quot;callback=user.toolbar_link_builder%3ArenderDisplayName\u0026\u0026token=-MH2NzEnTzbzMk0ZGfGgoiw7G3j_-Q1ILWBRVhIOKLI&quot;:true,&quot;callback=shortcut.lazy_builders%3AlazyLinks\u0026\u0026token=N1997Wch59v-LxHku3-dD44wjkSNmhegNzlZ8jS0L5I&quot;:true},&quot;toolbar&quot;:{&quot;breakpoints&quot;:{&quot;toolbar.narrow&quot;:&quot;only screen and (min-width: 16.5em)&quot;,&quot;toolbar.standard&quot;:&quot;only screen and (min-width: 38.125em)&quot;,&quot;toolbar.wide&quot;:&quot;only screen and (min-width: 61em)&quot;},&quot;subtreesHash&quot;:&quot;fFW4IHdcFxAYeqwFjFGFpjKbwADtToCo9LEGFmDLWwY&quot;},&quot;user&quot;:{&quot;uid&quot;:&quot;1&quot;,&quot;permissionsHash&quot;:&quot;3e05456fe0e0014e93091ef2c6ad9fbbe0e5c07d9303f114c638bbc071d789d2&quot;}}&lt;/script&gt;

Whih both have settings? for the files that i want however the file mapping source looks like this

$( document ).ready(function() {
    console.log( &quot;ready!&quot; );
});

window.onload = &quot;test()&quot;;

function test() {
    console.log('123');
}
console.log('test');
var map = L.map('map', {
    center: [51.505, -0.09],
    zoom: 13
});

Which should be console logging SOMETHING surely? Is there something I'm missing?
Additional files look like this
helloworld.libraries.yml
helloworld:
  version: 1.x
  js:
    js/leaflet.js: {}
    js/mappingsource.js: {}

&lt;?php

/**
 * @file
 * Contains helloworld.module.
 */

helloworld.module
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function helloworld_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the helloworld module.
    case 'help.page.helloworld':
      $output = '';
      $output .= '&lt;h3&gt;' . t('About') . '&lt;/h3&gt;';
      $output .= '&lt;p&gt;' . t('Hello World example module') . '&lt;/p&gt;';
      return $output;

    default:
  }
}

function helloworld_page_attachments(array &amp;$attachments) {

  // Unconditionally attach an asset to the page.
  $attachments['#attached']['library'][] = 'helloworld/leaflet';
    $attachments['#attached']['library'][] = 'helloworld/mappingsource';

}

/**
 * Implements hook_theme().
 */
function helloworld_theme() {
  return [
    'helloworld' =&gt; [
      'render element' =&gt; 'children',
    ],
  ];
}
You need to attach complete libraries, not single library files. Your module has the name helloworld, this is the first part before the slash. In your libraries.yml you have defined the top key helloworld, this is the library name and the second part after the slash:
$attachments['#attached']['library'][] = 'helloworld/helloworld';

This line will attach all JS and all CSS listed under that specific library.
Sidenote: Try to use Drupal.behaviors instead of $(document).ready, this is the Drupal-way to do stuff like this. Otherwise you might run into problems with Ajax-calls or lazy-rendered blocks rendered with BigPipe module.