Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Dependencies are loaded more than once when a 3rd party library which supports AMD (has define statements) is loaded using steal?

$
0
0
We are trying to steal AMDfied jquery.cookie library, jquery.js is loaded twice as steal also supports AMD syntax.

How to load it as a regular library using steal?

// can/util/jquery/jquery.js
steal('jquery', 'can/util/can.js', 'can/util/array/each.js', function($, can) { // jquery is loaded 

// jquery.cookie.js
(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD (Register as an anonymous module)
        define(['jquery'], factory); // jquery is loaded 
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {
// library code
}));

Viewing all articles
Browse latest Browse all 3491

Trending Articles