NicolasCARPi / dropzone

Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.
http://www.dropzone.dev/js
Other
36 stars 3 forks source link

Class Methods not accessible via import #4

Closed joeworkman closed 2 months ago

joeworkman commented 2 months ago

This is not an issue. I just had a problem that I solved that I thought I would share my solution for with others in case they ran in to similar issues.

I am using esbuild and was importing Dropzone as usual...

import Dropzone from "@deltablot/dropzone";

However, I could not access any of the class methods such as Dropzone.createElement(). I was able to fix this through adding the following after the import statement.

import Dropzone from "@deltablot/dropzone";
globalThis.Dropzone = Dropzone;

There may be better ways to handle this but this got the job done for me.

NicolasCARPi commented 2 months ago

That's peculiar. Might be related to your environment. Anyway, thanks for opening this issue, it might help someone.