reinink / client-side-rendering-in-laravel

199 stars 36 forks source link

Cannot use duplicate vue component names? #3

Closed SamuelNitsche closed 5 years ago

SamuelNitsche commented 5 years ago

Thank you for this project. I really like the idea but I have a question. I am unable to render vue components with the same name but different locations via the View::component() macro.

Example: I have an Index.vue file in the folder <project root>/resources/js/Front/Index.vue and <project root>/resources/js/Back/Index.vue

Am I missing something or isn't this possible? Thank you!

reinink commented 5 years ago

Yes, that makes sense. You have to use unique component names when auto registering Vue components like this, otherwise you'll run into naming collisions. More on this technique here: https://github.com/laravel/laravel/pull/4843

Another option is to just manually register your Vue components:

Vue.component('example-component', require('./components/ExampleComponent.vue'));
SamuelNitsche commented 5 years ago

Wow, that was quick :) I see, I think I should have known this.