FredrikOseberg / react-chatbot-kit

MIT License
324 stars 154 forks source link

Widget : Unexpected Token '<' Error #153

Closed Rohan-Hazari closed 1 year ago

Rohan-Hazari commented 1 year ago

I followed the recent docs and tried to to the DogPicture widget but I kept getting this error Unexpected Token '<' at the widgetFunc line image image

I dont understand What I did wrong

this is my config file (also showing my directory just in case ) image

void-ness commented 1 year ago

Facing the same error. However adding something like below works. but this won't pass down any props

widgets: [
        {
            widgetName: 'dogPicture',
            widgetFunc: (props) => DogPicture,
        },
    ],
Rohan-Hazari commented 1 year ago

Thanks @void-ness that worked

void-ness commented 1 year ago

@Rohan-Hazari I noticed the above error only while instantiating a react app using vite. I tried instantiating a react app using "create-react-app" template and the above error wasn't seen.

Therefore it has something to do with one of the dependencies by vite.

0x41head commented 8 months ago

For anyone who comes across this issue in the future. You may use something like this to pass props in Vite.

widgets: [
        {
            widgetName: 'dogPicture',
            widgetFunc: (props) => DogPicture(props),
        },
    ],