As suggested by an answer to this question, the error
"unexpted token export"
is because the code given below is in es6 syntax but Node JS uses common JS module.
const SidebarMenu = require('./components/SidebarMenu.vue')
export default {
install (Vue) {
Vue.component('sidebar-menu', SidebarMenu)
}
}
export { SidebarMenu }
Please help me to convert it to commonJS module.
I have tried module.exports
as below
const SidebarMenu = require('./components/SidebarMenu.vue')
install = function (Vue) {
Vue.component('sidebar-menu', SidebarMenu)
}
module.exports = { SidebarMenu, install }
but it does not work either. I get an error that the component SidebarMenu
was not found.