global-react
v0.2.0
Published
Let multiple browserified React components co-exists
Downloads
5
Readme
global-react
When you want something like
<script src="path/to/react-component-1.js"></script>
<script src="path/to/react-component-2.js"></script>
<script src="path/to/react-app.js"></script>
that you can use component-1 and component-2 in app, but react-component-1.js and react-component-2.js are browserified along with React already, you will run into errors.
How to solve it
npm install --save-dev global-react
browserify entry1.js -g global-react -o react-component-1.js
browserify entry2.js -g global-react -o react-component-2.js
browserify app.js -g global-react -o react-app.js
Change the HTML page to
<script src="path/to/global.react.js"></script>
<script src="path/to/react-component-1.js"></script>
<script src="path/to/react-component-2.js"></script>
<script src="path/to/react-app.js"></script>