0.0.1 • Published 6 years ago

bostjan-test-component-usage-example v0.0.1

Weekly downloads
3
License
SETCCE
Repository
-
Last release
6 years ago

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

  1. unzip / clone
  2. Run npm install (installs neccesary packages in node_modules)
  3. Run npm run bundle-js (builds wrapper js files for inclusion in normal web page)
  4. 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

  1. Replace references to chat-template and change the method name in wrapper.js
  2. Update method name and the output file names in the two webpack config files.
  3. Update index.html
  4. Run the usage steps.