-
Notifications
You must be signed in to change notification settings - Fork 18
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
JSON polyfill loads asynchronously in RequireJS #8
Comments
Hey @jeffrose! We're not attempting to load the json2 file sync. It's intentionally async. (Note: we simplified this code in the dev branch, but it's still async.) Hmmmm.... looks like RequireJS no longer supports the priority config param. Now you have to use the shim config option, it seems. ???? Have you tried using shim? -- John |
Okay, it was not clear to me why a promise was being used to load the JSON shim. You are correct that the priority config is gone. So what I do instead is set dependencies on my main module. // app.js
define( [ "poly", "has" ], ... ); The problem stems from the fact that while this works great for the referenced dependencies, e.g. |
Ok I see. thanks for the code snippet. Is it possible to either a) make poly an app-wide dependency, or b) build poly using r.js? -- John Sent from planet earth On Oct 5, 2012, at 11:53 AM, Jeff Rose notifications@github.com wrote: Okay, it was not clear to me why a promise was being used to load the JSON You are correct that the priority config is gone. So what I do instead is // app.jsdefine( [ "poly", "has" ], ... ); The problem stems from the fact that while this works great for the — |
a) I'm not sure offhand. b) We'll be implementing specialized builds (old n' busted vs. new hotness) using the has API early next year, but at the moment we're not prepared to support that. |
I'm sure I was clear in my previous question. What I meant by (a) is: Can you use a RequireJS shim instead of making it a dependency? |
Hm, wait. The version in the dev branch should work as a dependency. https://github.com/cujojs/poly/blob/dev/json.js Did you try that version? |
Sorry, I accidentally skipped over that. The For example... require.config( {
shim: {
"qunit": {
"exports": "QUnit"
}
}
} );
require( [ "qunit" ], function( QUnit ){ ... } ); So I'm not sure that putting JSON into the |
Ok, let me take a look at the dev branch and see if that solves the issue. |
this fix was released in 0.5.2 |
While it looks like an effort has been made to load the JSON polyfill synchronously, in RequireJS it still seems to load asynchronously and therefore can be too late to provide the necessary functionality.
The text was updated successfully, but these errors were encountered: