maxulyanov / ImageComparison

Slider to quickly compare two images

Home Page:https://m-ulyanov.github.io/image-comparison/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UMD wrapper? CommonJS Support

rhewitt22 opened this issue · comments

Excellent module! I'm excited to find a solution that doesn't require jQuery.

I'm using browserify to manage and bundle javascript. I see you're attaching ImageComparison to the window as a global. It would be great if you could use a UMD wrapper to support CommonJS and RequireJS.

var ImageComparison = require('image-comparison'); results in an error (module 'image comparison' not found). package.json's main field is pointing towards a file that doesn't exist (index.js). The main field should be src/js/ImageComparison.js at a minimum so the file can be required even if it's just attached to the window.

commented

This is an old Issue but still needs to be fixed.

Like @rhewitt22 mentioned, you can install it with npm but you can't use it in the standard required or import way (import ImageComparison from 'image-comparison';) when using something like webpack (or other bundlers).

Other than that issue, works great and does everything I need it to!

Version 2.0.2 adds support commonJS and ES6 import! See the readme for more information.