Comments (4)
cajon detects usage of node module APIs (like require/exports) and if detected, wraps the content in a define() function wrapper, then evals it. Since backbone tries to call node APIs if in node, cajon detects the API usage and wraps in a define() function wrapper.
This changes the scope and "this" value when Backbone executes. Since backbone does not try to use the node APIs to fetch jquery (instead tries to grab it off "this"/global, which is goofy in some respects), it fails.
What I can look at doing is to avoid doing the define() wrapping if there is a shim config set up for the file. I need to set up a backbone test to confirm the fix though. Will try to sort it out soon.
from cajon.
Ah, gotcha. Is the temp workaround to change the root.jQuery to a requjre('jquery') in backbone? I'll try it out
On Mar 20, 2013, at 7:08 PM, James Burke [email protected] wrote:
cajon detects usage of node module APIs (like require/exports) and if detected, wraps the content in a define() function wrapper, then evals it. Since backbone tries to call node APIs if in node, cajon detects the API usage and wraps in a define() function wrapper.
This changes the scope and "this" value when Backbone executes. Since backbone does not try to use the node APIs to fetch jquery (instead tries to grab it off "this"/global, which is goofy in some respects), it fails.
What I can look at doing is to avoid doing the define() wrapping if there is a shim config set up for the file. I need to set up a backbone test to confirm the fix though. Will try to sort it out soon.
—
Reply to this email directly or view it on GitHub.
from cajon.
Another option is to use the amdified version of backbone from https://github.com/amdjs/backbone, but understand if you do not want to take fork like that.
from cajon.
This is now fixed in the just-releases cajon 0.1.4. However, a change was also needed in the optimizer, to not do the cjsTranslate wrapping, tracked in requirejs/r.js#408. That fix will go out in r.js 2.1.6, which may be another week or so away. In the meantime, you can use the latest master snapshot if you want to do builds that work with this setup.
This is also a demo-shim
directory in this repo that I used to confirm the changes.
from cajon.
Related Issues (15)
- 'use strict' causing script loading errors. HOT 2
- Support require([js-data-uri]); HOT 1
- Cajon treats CoffeeScript compiler as a CommonJS module HOT 1
- Require-CS not working with Cajon HOT 3
- Remove Query from path in debugger... HOT 1
- Upgrading from 0.1.14 -> 0.2.4, `global` should be defined HOT 6
- `exportsPropRegExp` should also check for array notation.
- not working with text plugin HOT 9
- "exports is not defined" HOT 2
- Not working with handlebars via the requirejs-handlebars plugin? HOT 3
- Evaled scripts show up under (no domain) in chrome
- Conditional comments around sourceUrl comment causing grey hair HOT 3
- Code has to be evaluated in global scope HOT 5
- Cajon is not available via Bower HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cajon.