title: Register a component to an existing Vue.js instance
body: <p>I'm new to Vue.js.</p>
  <p>I want to register a local component as described over here:</p>
  <p><a href="https://v2.vuejs.org/v2/guide/components.html#Local-Registration" rel="nofollow noreferrer">https://v2.vuejs.org/v2/guide/components.html#Local-Registration</a></p>
  <p>The only issue is that I need to register a component to an <strong>existing</strong> Vue instance not while creating a new instance something like:</p>
  <pre><code>const app = new Vue({
      el: '#app'
  });
      
  app.component({
      'my-component': {
           template: '&lt;div&gt;A custom component!&lt;/div&gt;'
      }
  });
  </code></pre>
  <p>I have tried Vue.extend for that, but it is not working.</p>
  <p><strong>Edit:</strong></p>
  <p>Why I need this:</p>
  <p>I'm creating a 3rd party package which will have that component. The framework on which this package is going to be installed will already have Vue.js included and a Vue instance. So if I include my package's JS before framework's JS, then it will give me Vue is undefined and if I include my package's JS after framework's JS, then it will give me component error as it has to be registered before the Vue instantiation.</p>