1

I'm building a component library based on Vuetify.

Vuetify installation tells people to add this line

new Vue({
  vuetify,
  render: h => h(App)
}).$mount('#app')

However, I want people to be able to just import my component.

It looks like this

<template>
  <HelloWorld />
</template>

<script>
import { HelloWorld } from "MyComponentLibrary";

export default {
  components: {
    HelloWorld,
  },
};
</script>

Now, if this line of Vuetify is necessary...

new Vue({
  vuetify,
});

I will have to make my component library API looks like this

import { reExportedVuetify } from "MyComponentLibrary";

new Vue({
  vuetify: reExportedVuetify,
});

So, what does new Vue({ vuetify }) do?

Joseph
  • 3,974
  • 7
  • 34
  • 67
  • 1
    That line actually instantiates and launches your Vue app. You would not put that in an importable component. – deceze Nov 17 '20 at 06:14
  • 1
    `Vuetify` line initializes Vuetify library and registers its components inside your app. I think that it will be best if you do not build/bundle your library but provide it as ES6-importable group of components. – IVO GELOV Nov 17 '20 at 07:24

0 Answers0