Skip to content

Transpiling to ES5 causes Uncaught TypeError #3

Description

@skyclb

Dear Ulyanov,

I want to thank you for creating this module, i do like it very much because of its lightweight size and simplicity. I recently used it for the first time and unfortunately encountered an js error when running under production mode.

I am using a gulp js minifier module which only accepts ES5, thats why i recognized your plugin been shiped as ES6 source. I did point my babel to transpile it to ES5 which worked without any error inside my dev setup. But then in the console i got the following error on this line:

if (typeof define === 'function' && define.amd) {
    define('ImageComparison', [], function() {
        return ImageComparison;
    });
} else {
    root.ImageComparison = ImageComparison;
    ^ Uncaught TypeError: Cannot set property 'ImageComparison' of undefined
}

I did double check my setup for causes, without success. Also i use two other npm modules shipped in ES5 which work perfectly. Removing the causing js block from your plugin does fix the error but corebreaks your module.

While searching your github, npm and examples page, i recognized that your example pages source js differs to the one in your github repo.

I hope to hear soon from you, i am out of ideas...

Best regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions