theming – 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') }}
            <div class="countup">
              <div id="transit_count">0</div>
              <script>
                $(function() {
                  let transits = new CountUp('transit_count', 6699);
                  if (!transits.error) {
                    transits.start();
                  } else {
                    console.error(transits.error);
                  }
                });
              </script>
            </div>

When I flushed the cache, I got this error: “Uncaught ReferenceError: CountUp is not defined”.

What am I missing here? I’m pretty weak at JS so it could be something obvious.

Thanks!