I am using vue cli 3 with typescript support. Actually, i'm trying to create web component using vuejs.
main.ts
import Vue from 'vue';
import './plugins/vuetify';
import App from './App.vue';
import router from './router';
import store from './store';
import wrap from '@vue/web-component-wrapper';
import RoleManagement from './views/role-management/RoleManagement.vue';
const CustomElement = wrap(Vue, RoleManagement);
window.customElements.define('custom-component', CustomElement);
Vue.config.productionTip = false;
new Vue({
router,
store,
render: (h) => h(App),
}).$mount('#app');
Command to create web component is as follows,
vue-cli-service build --target wc --name custom-component ./src/main.ts
After this getting error,
Cannot find module '@vue/cli-plugin-babel'
@vue/cli-pluginS-babel/preset
, with emphasis on the S, as the package name is without the S. Don't know if this has any bearing on it.. – Chondrite