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='https://www.example.com/example.min.js'></script>

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

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

<script>
    $example_function.doSomething(param1,param2);
    $example_function.doSomething2();
</script>

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'

Vue.use(Example)

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

Is it possible to achieve this?