datocms / structured-text

MIT License
22 stars 7 forks source link

Object(...) is not a function Error after updating to Node 18 #30

Open benjaminchallenor opened 11 months ago

benjaminchallenor commented 11 months ago

Hi, we testing updating our site to node 18. We are using datocms-structured-text-generic-html-renderer v2.0.4 in an accordion component. The render function is now returning the error Object(...) is not a function. A snippet of how we are using the function can be found below:

const defaultAdapter = {
      renderNode: hAdapter,
      renderMark: hAdapter,
      renderFragment: (children, key) => createElement('div', { key }, children),
      renderText: (text) => text,
    }

    return render(
      {
        renderText: this.renderText || defaultAdapter.renderText,
        renderNode: this.renderNode || defaultAdapter.renderNode,
        renderFragment: this.renderFragment || defaultAdapter.renderFragment,
      },
....
marcelofinamorvieira commented 11 months ago

Hello @benjaminchallenor

Can you confirm that if you downgrade the node to a previous version the same snippet works? If so, can you provide us with a step by step way to reproduce this on our end? As i tried with a generic render and Node 18 and couldn’t reproduce the issue :(

Perhaps you are experiencing something similar to the issue solved here: https://github.com/datocms/vue-datocms/issues/87