Skip to content

Commit bb066b8

Browse files
committed
[added] Browser build script
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
1 parent baf79b6 commit bb066b8

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

package.json

+19-7
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,36 @@
2424
],
2525
"license": "MIT",
2626
"devDependencies": {
27-
"webpack": "^1.2.0-beta5",
28-
"jsx-loader": "^0.10.2",
27+
"browserify": "^4.2.3",
28+
"browserify-shim": "^3.6.0",
2929
"bundle-loader": "^0.5.0",
30+
"envify": "~1.2.0",
3031
"expect": "^0.1.1",
31-
"mocha": "^1.20.1",
32+
"jsx-loader": "^0.10.2",
3233
"karma": "^0.12.16",
33-
"webpack-dev-server": "^1.4.2",
34-
"karma-webpack": "^1.2.1",
35-
"karma-mocha": "^0.1.3",
3634
"karma-chrome-launcher": "^0.1.4",
3735
"karma-cli": "0.0.4",
36+
"karma-firefox-launcher": "^0.1.3",
37+
"karma-mocha": "^0.1.3",
38+
"karma-webpack": "^1.2.1",
39+
"mocha": "^1.20.1",
3840
"rf-release": "^0.1.2",
39-
"karma-firefox-launcher": "^0.1.3"
41+
"uglify-js": "^2.4.15",
42+
"webpack": "^1.2.0-beta5",
43+
"webpack-dev-server": "^1.4.2"
4044
},
4145
"dependencies": {
4246
"react": "^0.10.0",
4347
"es6-promise": "^1.0.0",
4448
"event-emitter": "^0.3.1",
4549
"querystring": "^0.2.0"
50+
},
51+
"browserify": {
52+
"transform": [
53+
"browserify-shim"
54+
]
55+
},
56+
"browserify-shim": {
57+
"react": "global:React"
4658
}
4759
}

script/build

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
BROWSERIFY="node_modules/.bin/browserify"
3+
VERSION=`node -p "require('./package').version"`
4+
5+
NODE_ENV=production $BROWSERIFY modules/main.js --detect-globals false -t envify > build/react-nested-router-$VERSION.js
6+
NODE_ENV=production $BROWSERIFY modules/main.js --detect-globals false -t envify | uglifyjs --compress warnings=false > build/react-nested-router-$VERSION.min.js

0 commit comments

Comments
 (0)