Skip to content
New issue

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

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

Already on GitHub? # to your account

Output dist doesn't work in AMD environments because of browserify-shim #8

Open
pixeldrew opened this issue Jun 24, 2015 · 3 comments

Comments

@pixeldrew
Copy link

browserify-shim incorrectly rewrites require('react') to (window.React).

in a new version of browserify-shim, it rewrites to this (which is still broken):

var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);

This might not be a bug but by the design of browserify-shim. It should be mentioned in your docs that the output of react-components-gulp-tasks will not be A/UMD compatible.

I was able to successfully make a UMD build using webpack.

@pixeldrew pixeldrew changed the title Output dist doesn't work in AMD environments because of browserify standalone Output dist doesn't work in AMD environments because of browserify-shim Jun 24, 2015
@mondaychen
Copy link

+1 for this.
I tried to use https://github.com/JedWatson/react-select in my AMD project and met the same problem.
A tip for anyone who needs UMD support, I was able to do it with this: mondaychen/react-select@f6c87d2 . Probably not the best way but works.

@jochenberger
Copy link

I tried to rewrite this library to use https://github.com/eduardolundgren/gulp-umd instead of browserify-shim, but couldn't get it to work. I always end up with an empty file as dist-script.
I can however create a PR with what I have, maybe someone who is more experienced with node and gulp can tell me what I'm doing wrong.

@jochenberger
Copy link

See #25

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants