0

I'm trying to Build a React Embeddable widget and bundle it to use in different websites (HTML, React, Next....),

I’m using parcel to bundle widgets component, and it's worked fine.

I imported the bundler file like this:

<body>
 ...
 
 <link href="./index.css" rel="stylesheet"/>
 <script async src="./index.js"></script>
</body>

but the problem that I have is how to create a function to initialize data for the widget and use it like that

<body>
 ...
 
 <link href="./index.css" rel="stylesheet"/>
 <script async src="./index.js"></script>
 <script>
  init({
    color: 'white',
    background: 'black',
    ...props
 })
 </script>
</body>

I tried to use rollup to do it, but I got this error:

TypeError: Cannot read properties of undefined (reading 'render')

for more infos about configs:

https://github.com/casbah-ma/social-proof/tree/dev

if anyone have an idea how to solve it, please help.

0 Answers0