// main.js

/**
 *  Automated module export and auto-install
 *  https://vuejs.org/v2/cookbook/packaging-sfc-for-npm.html
 */
import plugin, * as components from '../src/entry.esm';
import App from './App.vue';
import Vue from 'vue';
import '../styles.scss';

/**
 * Attach named exports directly to plugin.
 */

Object.entries(components).forEach(([componentName, component]) => {
    if (componentName !== 'default') {
        plugin[componentName] = component;
    }
});

/**
 * Auto-install when vue is found (eg. in browser via <script> tag)
 * @type {null}
 */
let GlobalVue = null;
if (typeof window !== 'undefined') {
  GlobalVue = window.Vue;
} else if (typeof global !== 'undefined') {
  GlobalVue = global.Vue;
}
if (GlobalVue) {
  GlobalVue.use(plugin);
}


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

export default plugin;
