It turned out to be much simpler than expected:
All I had to do was create a separate entry file for webpack:
my-custom-component-entry.js
Then, I added everything I needed in that file (Vue and the custom component):
// Here is the solution I've been searching for.
import Vue from 'vue';
import MyCustomComponent from './components/my-custom-component.vue';
new Vue({
components: {
'my-custom-component': MyCustomComponent
}
}).$mount('#app'); // Make sure there's a #app element somewhere in your HTML
After that, I built it with webpack (I won't go into details here).
Now everything is bundled in one file. There's no need for a separate Vue runtime for customers to install. All you have to do is:
<script src="https://www.myxyzhost.com/dist/my-custom-component.js"></script>
Of course, make sure to add the necessary polyfills for Internet Explorer to prevent any issues.
The best part is that for modern browsers, it's just a one-liner, making it easier to market. That's all I needed.