electerious / basicLightbox

The lightest lightbox ever made.
https://basiclightbox.electerious.com
MIT License
564 stars 55 forks source link

Can't import from minified source #14

Closed funkyfuture closed 6 years ago

funkyfuture commented 6 years ago

in my javascript file i import basicLightbox with import * as basicLightbox from './basicLightbox.js';, however when i have the minified version in place there, i get an Uncaught TypeError: basicLightbox.create is not a function where i call basicLightbox.create. with the plain source it works just fine.

electerious commented 6 years ago

Can you do a simple console.log(basicLightbox)? Would be interesting to see what it contains.

Are you minifying your code afterwards? Maybe the error occurs because of the double-minification (it shouldn't, but it's possible). Can you try it with your minification turned off?

funkyfuture commented 6 years ago

i use the dist.basicLightbox.min.js and the log says Symbol(Symbol.toStringTag): "Module".

electerious commented 6 years ago

This isn't saying me anything, but it could be because you're rebundling everything and the minified version is already bundled. I would recommend to stay with unminified source. Let me know if you find out more.

funkyfuture commented 6 years ago

because you're rebundling everything

no, i'm still too fresh and incompetent in Javascript to figure out how to do this. might the error evoke because i have type="module" specified in the embedding script tag?

electerious commented 6 years ago

Could be, but I haven't used type="module", yet. I will keep the issue open, but can't provide a solution. Maybe someone else has the same issue and hopefully knows what's going on.

electerious commented 6 years ago

Closing this issue because I can't provide a solution.