Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.