Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Minification failed. Strict-mode does not allow assignment to undefined variables: Sortable

Open YovavGad opened this issue 10 years ago • 2 comments

I'm getting this error when trying to minify sortable.js in Visual Studio 2015 (MVC project):

Minification failed. Returning unminified contents. (689,213-221): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: Sortable

Bindings: jquery.binding.js and sortable.js v1.5.0-rc1

Not sure how to fix it, but as a work around I'm creating a separate script bundle that is not minified

YovavGad avatar Dec 03 '16 06:12 YovavGad

The problem is the line 18 - it assigns factory() to the global object Sortable that is not defined before. This is not allowed in strict mode. I already created a fix for this issue long time ago, but it wasn't merged.

As workaround you can pass global context to the IIFE and assign Sortable to it, something like this:

(function(global, factory) {
    "use strict";

    // instead of Sortable = factory();
    global["Sortable"] = factory();
})(this, function() { return {}; });

denis-taran avatar Dec 10 '16 15:12 denis-taran

Try master

RubaXa avatar Feb 16 '17 19:02 RubaXa