How to create and publish a vue global function to NPM?

I know it sounds a bit confusing, but let me explain it here:

Right now there's a module that can be imported as CDN only:

<script src=''></script>

after including it in index.html (or any .html file)

There's a few functions that can use from the module


Because the module does not available as NPM package and for people like me want to use it in webpack built Vue.js project it's not so straight forward to use this module.

I know there's plenty of ways to workaround but I want it to be simple as I can just import it globally like other npm packages

import Example from 'example'


then I can call the function in any Vue components, or in my future vue projects.

Is it possible to achieve this?