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'
facing this issue with v3.1.2 but it works when i downgrade to v3.1.0 (with a warning that this version is no longer maintained) a temporary work around.This can be a possibility to your problem