@samitouri / QOS-React-2 / commits / 0c6bbf275b
Fork 0

The library for web and native user interfaces.

Ship CJS modules instead of browserified build

It turns out that if you try to browserify a file requiring react-tools, it doesn't work. This is because browserify just visits the require statements in the file and looks for files in that path. ./ReactCompositeComponent doesn't exist and that's the point that fails. So the fix is to actually ship each of our CJS modules as individual files like browserify expects. This should have no negative side effects - we still only export React (though the rest of our modules are now actually accessible, which might make it easier to do more with the module). The other change here is to move source-map to dependencies since it's required in the transform code. Test Plan: ``` $ npm pack . $ cd /tmp $ npm install path/to/react-tools-0.3.1.tgz $ echo "require('react-tools')" > test.js $ browserify test.js ```

Paul O’Shannessy committed May 31, 2013 at 10:57 UTC 0c6bbf275bb14a0b37426a5caf3dfd31753d36f3
2 files changed +4 -4
main.js
+1 -1
@@ -1,6 +1,6 @@
1 'use strict';
2
3 -var React = require('./build/react');
3 +var React = require('./build/modules/React');
4 var visitors = require('./vendor/fbtransform/visitors').transformVisitors;
5 var transform = require('./vendor/fbtransform/lib/transform').transform;
6
package.json
+3 -3
@@ -16,7 +16,7 @@
16 "README.md",
17 "main.js",
18 "bin/jsx",
19 - "build/react.js",
19 + "build/modules/",
20 "vendor/fbtransform/",
21 "vendor/woodchipper.js"
22 ],
@@ -35,7 +35,8 @@
35 "base62": "~0.1.1",
36 "commoner": "~0.6.8",
37 "esprima": "git://github.com/facebook/esprima#fb-harmony",
38 - "recast": "~0.3.3"
38 + "recast": "~0.3.3",
39 + "source-map": "~0.1.22"
40 },
41 "devDependencies": {
42 "browserify": "~2.14.2",
@@ -47,7 +48,6 @@
48 "optimist": "~0.4.0",
49 "phantomjs": ">= 1.9.0",
50 "semver": ">= 1.1.4",
50 - "source-map": "~0.1.22",
51 "uglify-js": "~2.3.6",
52 "grunt-contrib-clean": "~0.4.1",
53 "grunt-compare-size": "~0.4.0",