Closed arpowers closed 3 years ago
These libraries do not provide modular imports, so I think they should be used in the original way https://github.com/CHOYSEN/datamaps-example
Thanks for the example, the problem with the implementation is just that the JS is loaded globally to the website. I suppose that's may be what we need to do to use this particular lib.
I only has two idea for this, that should work for you.
this
inside iife.This always is not related of vite core, so i close it for clear issue, we also can disscus it.
As you may know,
this
is undefined in es6 modules: https://stackoverflow.com/questions/48670599/why-is-this-undefined-in-script-type-moduleBecause of this being undefined, there is a problem using older libs like this one: https://datamaps.github.io/ In these libs, they typically use IIFE's which assume
this = window
Is there a way to patch this problem?