0
votes

I'm trying to require a .vue single file component to my php app but i can't make it work without the inline template method. So since i don't have a node main.js to import Vue and require the components, how can i require my .vue or compiled .js component to the component registration?

Working component registration:

Vue.component('example-component', ({
    template: "<div>The component template</div>"
}));

Not working

Vue.component('example-component', require('./components/js/ExampleComponent.vue'));

Thanks!

1

1 Answers

0
votes

Try this:

Vue.component('example-component', require('./components/js/ExampleComponent.vue').default);