Skip to content

Instantly share code, notes, and snippets.

@johncip
Last active April 22, 2016 09:31
Show Gist options
  • Save johncip/934d7c353bfccf58d4515c87d59841e1 to your computer and use it in GitHub Desktop.
Save johncip/934d7c353bfccf58d4515c87d59841e1 to your computer and use it in GitHub Desktop.
Browserify 3rd-party React components found on npm
# Browserify 3rd-party React components found on npm
# (prevents React & ReactDOM from being bundled)
export PACKAGE='simple-react-modal' # npm package
export EXPORT_NAME='SimpleReactModal' # will end up on window with this name
mkdir project && cd project
npm init -f
npm install -D browserify react react-dom
npm install $PACKAGE --save
echo "require('$PACKAGE');" > app.js
browserify app.js -o bundle.js -x react -x react-dom --standalone $EXPORT_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment