0.0.1 • Published 6 years ago
bostjan-test-component-usage-example v0.0.1
react-webpack-wrapper
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 bostjan-test-component, a React component that display simple box with title, image and description.
Usage
- unzip / clone
- Run
npm install
(installs neccesary packages in node_modules) - Run
npm run bundle-js
(builds wrapper js files for inclusion in normal web page) - Run the example
npm run example
(runs the example)
Step 3 will generate two files in the build folder. A bostjan-test-component.js and bostjan-test-component-min.js for production
See index.html file for an example how these files are consumed.
Adapting for a different component / adding new component
- 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.
0.0.1
6 years ago