An example node project showing how you can use webpack and babel to convert a react component to a js file that can be consumed by non-react websites.
The example provided is for Chat-Template, a React component that enables quick prototyping of bot conversations
- Clone the repo
- Run
npm install
- Run
npm run bundle-js
- Run the example
npm run example
Step 3 will generate two files in the build folder. A chat-template.js and chat-template-min.js.
See index.html for an example how these files are consumed.
- Replace references to chat-template and change the method name in wrapper.js
- Update method name and the output file names in the two webpack config files.
- Update index.html
- Run the usage steps.