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

Does not work together with the new Backbone 1.1.1 #114

Open
xoss opened this issue Feb 19, 2014 · 10 comments
Open

Does not work together with the new Backbone 1.1.1 #114

xoss opened this issue Feb 19, 2014 · 10 comments

Comments

@xoss
Copy link

xoss commented Feb 19, 2014

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'

@gkatsev
Copy link
Collaborator

gkatsev commented Feb 19, 2014

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.

@xoss
Copy link
Author

xoss commented Feb 19, 2014

Couldn't you just limit the use of Backbone to <= 1.1.0 in bower.json as a HOTFIX?

@xoss
Copy link
Author

xoss commented Feb 19, 2014

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.

@gkatsev
Copy link
Collaborator

gkatsev commented Feb 19, 2014

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.

@gkatsev
Copy link
Collaborator

gkatsev commented Feb 19, 2014

It seems to work for me. See https://gist.github.com/gkatsev/9096687

@xoss
Copy link
Author

xoss commented Feb 20, 2014

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.

@gkatsev
Copy link
Collaborator

gkatsev commented Feb 20, 2014

I wonder if the AMD stuff get mangled and thus become useless.
Could you post your minified versions to something like jsbin or jsfiddle?

@xoss
Copy link
Author

xoss commented Feb 20, 2014

Checkout https://github.com/xoss/backbone-nested-model-AMD
Run

  1. bower install
  2. grunt serve => Works just fine
  3. grunt serve:dist => Not working

Replace "backbone":"1.1.1." by "backbone":"1.1.0" in bower.json. Run the same procedure. 3. => works as well.

@darky
Copy link

darky commented Apr 23, 2014

You can use new feature in requirejs - wrapShim to resolve this problem for build
Or simplify use shim in requirejs for non-build version

@darky
Copy link

darky commented Apr 23, 2014

Although would be better to support it in backbone-nested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants