Open zkat opened 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.
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
).
I could probably use webpack, but browserify has always worked well for me and I would like to keep compatibility with its transforms.
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:
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
browserify
doesn't recursively transform dependencies innode_modules/
even when you use the--global-transform
flag. This makes it pretty tricky to actually use thesteal
version ofcanjs
withdestealify
.My current remedy for this is to just use
webpack
, and I've added an example inexamples/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 forbrowserify
, 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 ofwebpack
, please comment in this issue and we can figure out what can be done.