tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.32k stars 1.68k forks source link

Add better check for commonjs #223

Open nrgwsth opened 6 years ago

nrgwsth commented 6 years ago

I am working on browser but I have a global variable called module . Instead of assigning domtoimage to window, it exports it because typeof module!=='undefined' check passes. So add additional check for commonjs.

tsayen commented 5 years ago

Hi, I don't know how, but this breaks a lot of tests in FF. Can't merge it for now. There is also a plan to rewrite this lib using more modern JS.

jkassis commented 4 years ago

is there a workaround? this simply crashes for me... global is undefined.

Uncaught TypeError: Cannot set property 'domtoimage' of undefined

I see this is my rollup output...

The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten