Skip to content

Commit

Permalink
[added] Browser build script
Browse files Browse the repository at this point in the history
There is currently no way to NOT use Browserify's "process" shim
since the code we're requiring in react/lib uses the process object,
so the build is slightly larger than it needs to be. If React core
would expose the stuff in react/lib as modules, we could avoid it.

Fixes #73
  • Loading branch information
mjackson committed Jul 21, 2014
1 parent baf79b6 commit bb066b8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
26 changes: 19 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,36 @@
],
"license": "MIT",
"devDependencies": {
"webpack": "^1.2.0-beta5",
"jsx-loader": "^0.10.2",
"browserify": "^4.2.3",
"browserify-shim": "^3.6.0",
"bundle-loader": "^0.5.0",
"envify": "~1.2.0",
"expect": "^0.1.1",
"mocha": "^1.20.1",
"jsx-loader": "^0.10.2",
"karma": "^0.12.16",
"webpack-dev-server": "^1.4.2",
"karma-webpack": "^1.2.1",
"karma-mocha": "^0.1.3",
"karma-chrome-launcher": "^0.1.4",
"karma-cli": "0.0.4",
"karma-firefox-launcher": "^0.1.3",
"karma-mocha": "^0.1.3",
"karma-webpack": "^1.2.1",
"mocha": "^1.20.1",
"rf-release": "^0.1.2",
"karma-firefox-launcher": "^0.1.3"
"uglify-js": "^2.4.15",
"webpack": "^1.2.0-beta5",
"webpack-dev-server": "^1.4.2"
},
"dependencies": {
"react": "^0.10.0",
"es6-promise": "^1.0.0",
"event-emitter": "^0.3.1",
"querystring": "^0.2.0"
},
"browserify": {
"transform": [
"browserify-shim"

This comment has been minimized.

Copy link
@sophiebits

sophiebits Jul 21, 2014

Contributor

If you add envify as a transform here you probably won't get the process shim included.

This comment has been minimized.

Copy link
@mjackson

mjackson Jul 21, 2014

Author Member

Ah, yeah. I forgot to edit that part out of the commit message. I'm using the -t flag in the build script tho, so we don't get Browserify's process module in the build. I'll move it to here tho.

]
},
"browserify-shim": {
"react": "global:React"
}
}
6 changes: 6 additions & 0 deletions script/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
BROWSERIFY="node_modules/.bin/browserify"
VERSION=`node -p "require('./package').version"`

NODE_ENV=production $BROWSERIFY modules/main.js --detect-globals false -t envify > build/react-nested-router-$VERSION.js
NODE_ENV=production $BROWSERIFY modules/main.js --detect-globals false -t envify | uglifyjs --compress warnings=false > build/react-nested-router-$VERSION.min.js

0 comments on commit bb066b8

Please sign in to comment.