VUE-CLI: Adding external CDN script

Hi, I tried following the instructions given in https://forum.vuejs.org/t/vue-cli-adding-external-js-and-css-libraries/38946/10 but it’s not working.
I’m new to vuejs and I’m having a hard time importing mapkit from cdn into vuejs components, it gives an error saying that mapkit can’t be resolved.

Here’s part of my code:

// vue.config.js, which I created manually
module.exports = {
    chainWebpack: config => {
        config
            .externals(
            {
                ...config.externals,
                'mapkit': 'mapkit'
            }
        );
    }
}

I added the apple maps cdn script in public/index.html at the bottom (right before the closing body tag)

And then in one of the components I added import mapkit from 'mapkit'

PS: I know there’s a mapkit npm but I would like to know why my implementation is not working, could be useful in the future.

Thank you in advance