blueimp/JavaScript-Canvas-to-Blob

Problems with AMD Loader

nagiek opened this issue · 1 comments

I was having problems with the AMD loader for this repo and your Load-image repo (require.js mismatch error). I switched to the intro/outro pattern that you have in your fileupload.js script, which fixed the problem.

I think you should consider copying the same style.

Sample intro copied for relevance.

(function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        // Register as an anonymous AMD module:
        define([
            'jquery',
            'jquery.ui.widget'
        ], factory);
    } else {
        // Browser globals:
        factory(window.jQuery);
    }
}(function ($) {
    'use strict';
    ...

If you use require.js, make sure to load this library via require.js and not via a normal script tag, since it includes an anonymous define call:
http://requirejs.org/docs/errors.html#mismatch