Adding Count Up module to custom front page My end goal is to put several Count Up numbers on my custom front page. But I'm having trouble getting it implemented.
First, I installed the Count Up library (https://github.com/inorganik/CountUp.js) and put it in the libraries directory.
Then in mytheme.libraries.yml, I put
countup:
  version: 1.0
  js:
    /libraries/countup.js/dist/countUp.umd.js: {}
  dependencies:
    - core/jquery

And then in page--front.html.twig, I put
{{ attach_library('mytheme/countup') }}
            &lt;div class=&quot;countup&quot;&gt;
              &lt;div id=&quot;transit_count&quot;&gt;0&lt;/div&gt;
              &lt;script&gt;
                $(function() {
                  let transits = new CountUp('transit_count', 6699);
                  if (!transits.error) {
                    transits.start();
                  } else {
                    console.error(transits.error);
                  }
                });
              &lt;/script&gt;
            &lt;/div&gt;

When I flushed the cache, I got this error: &quot;Uncaught ReferenceError: CountUp is not defined&quot;.
What am I missing here? I'm pretty weak at JS so it could be something obvious.
Thanks!
Working sample:
     &lt;!DOCTYPE HTML&gt;
     &lt;html&gt;
     &lt;head&gt;
       &lt;meta charset=&quot;UTF-8&quot;&gt;
       &lt;title&gt;CountUp.js&lt;/title&gt;

       &lt;script src=&quot;https://code.jquery.com/jquery-3.6.0.min.js&quot;&gt;&lt;/script&gt;
       &lt;script src=&quot;dist/countUp.umd.js&quot;&gt;&lt;/script&gt;
     &lt;/head&gt;

     &lt;body&gt;

        &lt;div class=&quot;countup&quot;&gt;
          &lt;div id=&quot;transit_count&quot;&gt;0&lt;/div&gt;
          &lt;script&gt;
            (function ($) {
              let transits = new countUp.CountUp('transit_count', 6699);
              if (!transits.error) {
                transits.start();
              } else {
                console.error(transits.error);
              }
            })(jQuery);

          &lt;/script&gt;
        &lt;/div&gt;

    &lt;/body&gt;
    &lt;/html&gt;