zkat / destealify

Browserify transform for processing StealJS modules
7 stars 0 forks source link

Support CanJS with browserify #1

Open zkat opened 10 years ago

zkat commented 10 years ago

browserify doesn't recursively transform dependencies in node_modules/ even when you use the --global-transform flag. This makes it pretty tricky to actually use the steal version of canjs with destealify.

My current remedy for this is to just use webpack, and I've added an example in examples/canjs-webpack to show people how to configure it to work well, as well as made notes about this issue in the readme. Webpack is a wonderful build tool that I believe can fully replace the use case for browserify, and includes better support for, say, amd, as well as for multiple output files/bundles.

If anyone reads this but really really really wants to use browserify instead of webpack, please comment in this issue and we can figure out what can be done.

jgillich commented 10 years ago

I would be interested in using CanJS with browserify, but after reading https://github.com/substack/node-browserify/issues/501, I don't think there is anything that could be done. They mention browserify-shim, but I have no clue how it works or if it is possible to combine it with this transform. I'll probably just use the global version for now.

zkat commented 10 years ago

Is there a reason you can't use webpack instead of browserify?

I'm pretty sure browserify-shim is only meant to be used for shimming modules that expose global/global-ish variables or have broken UMD code. It won't handle a different module syntax (like steal).

jgillich commented 10 years ago

I could probably use webpack, but browserify has always worked well for me and I would like to keep compatibility with its transforms.

focusaurus commented 10 years ago

If anyone reads this but really really really wants to use browserify instead of webpack, please comment in this issue and we can figure out what can be done.

:hand:

LaurensRietveld commented 10 years ago

I had the same problem as you in my library. The new version of browserify (6.1), published a week ago, supports a 'global' argument which transforms includes recursively. This might solve your issue