Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiling to ES5 causes Uncaught TypeError #3

Open
skyclb opened this issue May 5, 2020 · 2 comments
Open

Transpiling to ES5 causes Uncaught TypeError #3

skyclb opened this issue May 5, 2020 · 2 comments

Comments

@skyclb
Copy link

skyclb commented May 5, 2020

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

@skyclb
Copy link
Author

skyclb commented May 27, 2020

I did create a fiddle where you can reproduce it. Just check the console log.

https://jsfiddle.net/zhxr8k7j/1/

Best regards

@BehringBOB
Copy link

heyho @skyclb
I also had problems when trying out the latest version.

The example page shows another version, you can download here. I just stayed with using this version and had no problems.

Anyway, I also like the script a lot because its touchfriendly and leightweight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants