Open nothinghalosix opened 3 years ago
@nothinghalosix were you able to resolve this issue? I cannot build this with Gridsome
try this in your script
export default { components: { Carousel: () => import("vue-carousel") .then((m) => m.Carousel) .catch(), Slide: () => import("vue-carousel") .then((m) => m.Slide) .catch(), },
Thanks for that, I actually solved it by setting a client only condition.
added as plugin in main.js
if (process.isClient) {
Vue.use(require("vue-carousel").default);
}
in template file
<ClientOnly>
<carousel>
<slide>slide 1</slide>
<carousel>
</ClientOnly>
Registering as a plugin did not work for me, but registering individual components in main.js fixed the builds for me:
if (process.isClient) {
Vue.component('Carousel', require('vue-carousel').Carousel)
Vue.component('Slide', require('vue-carousel').Slide)
}
In the last few days, my Gridsome builds started erroring out. I was registering per-component earlier as @nothinghalosix shared. I do not know what the difference is with registering in main.js with isClient
check but it has fixed my issue.
(node:99081) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '__esModule' of undefined