Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ship CJS modules instead of browserified build #34

Merged
merged 1 commit into from
May 31, 2013

Conversation

zpao
Copy link
Member

@zpao zpao commented May 31, 2013

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

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
```
petehunt added a commit that referenced this pull request May 31, 2013
Ship CJS modules instead of browserified build
@petehunt petehunt merged commit 8d25909 into facebook:master May 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants