javascript - how to use q promise 2.X with requirejs on jsfiddle? -


this

requirejs.config({   paths: {      'q' : '//cdnjs.cloudflare.com/ajax/libs/q.js/2.0.3/q.min' }});  require(['q'], function(q) {   console.log("in loaded callback");   console.log("q: %o", q);   return {}; }); 

fails with:

module name "weak-map" has not been loaded yet context: _. use require([]) http://requirejs.org/docs/errors.html#notloaded file: require.min.js, line: 1, column: 1948 

see jsfiddle

however, works fine:

requirejs.config({   paths: {      'q' : '//cdnjs.cloudflare.com/ajax/libs/q.js/1.4.1/q.min' }}); 

i checked , found out q v2 experimental now. in source code can see has dependency following library

var weakmap = require("weak-map"); var iterate = require("pop-iterate"); var asap = require("asap"); 

and type of require/module import node/browserify. wont support require.js. per documentation:-

this q version 2 , experimental @ time. if install latest q npm, latest version 1 release train.

so better stick v1 @ point of time unless using in nodejs/browserify.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -