This project contains an example of how to build a component in react with Parcel2 that can be embedded as a global script in other, non-react pages.
It's a response to this stackoverflow question.
- Run
yarn
to install dependencies - Run
yarn build:widget
to build the react code with parcel. This will output a.css
and .js
file totest-consumer/dist-widget
folder. - Run
yarn serve
to servetest-consumer/index.html
at http://localhost:8080. This page is vanilla html that embeds the build.js
and.css
files built in step #2