I’m currently implementing a POC and pretty impressed by DatoCMS!
We are currently using the datacms-structured-text
and it’s renderBlock
feature in a Nuxt project which works as expected.
One thing though, as we’re focused on performance, we need to load components on demand to ensure only the necessary is JS is loaded on every page.
Something like :
renderBlock: async ({ record, key }) => {
if (record.__typename === 'HeroRecord') {
const hero = await import(`../components/${record.__typename.replace(/Record/g, '')}/index.vue`);
return h(hero.default, {
key,
props: {
title: record.title,
description: record.description,
image: record.image.responsiveImage,
},
})
}
return null
},
Our attempt at this can be found here but it’s faling with this error : [Vue warn]:
createElement() has been called outside of render function.
Any hint?