Custom Component - PortableTextEditor

  1. My goal: integrate the portableTextEditor playground to Retool as custom component.

  2. Issue: Encountered error

error

Error while importing custom component
error
: 
TypeError: Failed to resolve module specifier "react/compiler-runtime". Relative references must start with either "/", "./", or "../". at XS (https://retool-edge.com/libs/custom-component-collections.DS9AhuXc.umd.js:202:3546) at https://retool-edge.com/libs/custom-component-collections.DS9AhuXc.umd.js:202:2785
message
: 
"Failed to resolve module specifier \"react/compiler-runtime\". Relative references must start with either \"/\", \"./\", or \"../\"."
stack
: 
"TypeError: Failed to resolve module specifier \"react/compiler-runtime\". Relative references must start with either \"/\", \"./\", or \"../\".\n    at XS (https://retool-edge.com/libs/custom-component-collections.DS9AhuXc.umd.js:202:3546)\n    at https://retool-edge.com/libs/custom-component-collections.DS9AhuXc.umd.js:202:2785"

  1. Steps to reproduce:

this is my index.tsx file code

import { useEffect, useState, type FC } from 'react'
import { Retool } from '@tryretool/custom-component-support'
import {
  EditorProvider,
  PortableTextEditable,
} from '@portabletext/editor'
import { schemaDefinition } from './portable-text-editor/schema'
import { PortableTextToolbar } from './portable-text-editor/toolbar/portable-text-toolbar'
import { renderAnnotation, renderBlock, renderDecorator, renderListItem, renderPlaceholder, renderStyle, LinkPlugin } from './portable-text-editor/editor'
import { Container } from './portable-text-editor/primitives/container'
import { ImageDeserializerPlugin } from './portable-text-editor/plugins/plugin.image-deserializer'
import './portable-text-editor/editor.css'

export const PortableTextEditor: FC = () => {
  return (
    
    <div className="grid gap-2 items-start grid-cols-1 p-2 shadow-sm">
      <EditorProvider 
        initialConfig={{
          schemaDefinition
        }}
      >
               
        <Container className="flex flex-col gap-4 overflow-clip">
          <PortableTextToolbar /> //this line causes the error
           <div className="flex gap-2 items-center">
            <PortableTextEditable
              className={`rounded-b-md outline-none data-[read-only=true]:opacity-50 px-2 h-75 -mx-2 -mb-2 overflow-auto flex-1`}
              renderAnnotation={renderAnnotation}
              renderBlock={renderBlock}
              renderDecorator={renderDecorator}
              renderListItem={renderListItem}
              renderPlaceholder={renderPlaceholder}
              renderStyle={renderStyle}
            />
          </div> 
        </Container>
        <LinkPlugin />
        <ImageDeserializerPlugin /> 
      </EditorProvider> 
    </div>
  )
};

When commenting out the <PortableTextToolbar />, there are no error and it properly loads the component in retool but without the Toolbar.

The same code I used in a separate vite app which works perfectly.

I asked chatGPT and this is the reply

Your error is caused by the @portabletext/toolbar package, which imports "react/compiler-runtime" in its distributed code. This is not a valid public React API and will break in browser environments like Retool.

Compatibility check:

  • Your React, React DOM, and @types/react versions are compatible with each other and with most modern packages.
  • The rest of your dependencies are standard and should work with React 18+.
  • The only critical issue is with @portabletext/toolbar, which is not compatible with Retool or any browser-based environment due to its use of "react/compiler-runtime".

Could someone from the Dev team validate if this is true?
Thanks