Open xoss opened 10 years ago
Yeah, I wish that backbone didn't release it as 1.1.1. It should not be a patch version bump. Minor at least. We'll take a look.
Couldn't you just limit the use of Backbone to <= 1.1.0 in bower.json as a HOTFIX?
Just for the record: I totally agree with you, that the AMD compatibility is a huge change and should not be reflected by a minor version bump.
Unfortunately, that project is not interested in semver. Interestingly enough, the tests pass just fine. Though, that's probably because the tests don't use AMD.
It seems to work for me. See https://gist.github.com/gkatsev/9096687
So far, so good, ya. The problems occurs when you start to concat and minify the js to one single main.js file with requirejs. Even if you define a shim for backbone-nested-model, somehow Backbone does not get defined in the global namespace and is therefore not defined for Backbone.NestedModel. I didn't get into much research. As a hotfix I downgraded to Backbone 1.1.0, but maybe today I get the chance to dig a little deeper.
I wonder if the AMD stuff get mangled and thus become useless. Could you post your minified versions to something like jsbin or jsfiddle?
Checkout https://github.com/xoss/backbone-nested-model-AMD Run
Replace "backbone":"1.1.1." by "backbone":"1.1.0" in bower.json. Run the same procedure. 3. => works as well.
You can use new feature in requirejs - wrapShim to resolve this problem for build Or simplify use shim in requirejs for non-build version
Although would be better to support it in backbone-nested
Since Backbone 1.1.1, Backbone is AMD compatible. This, unfortunately, led to a not working backbone nested model, in case js has been concatinated and minified for production. Chrome yields: 'Uncaught Error: Backbone is not defined'