m90 / seeThru

HTML5 video with alpha channel transparencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot import cdn keep erroring out

lv2lrn4lf opened this issue · comments

cannot javascript import cdn keep erroring out:

//import "https://unpkg.com/seethru@4/dist/seeThru.min.js";
//import "https://cdn.jsdelivr.net/npm/seethru@2/dist/seeThru.min.js";
import "https://unpkg.com/seethru@latest/dist/seeThru.min.js";

in brwoser get error:

Uncaught TypeError: e is undefined

I just tried it via:

<script src="https://cdn.jsdelivr.net/npm/seethru@4/dist/seeThru.min.js"></script>

and it throw the same error!

Usage as an ES module is currently not supported (the library is much much older), so your first problem is expected. If someone wants to add an ESM version to the build, I am happy to merge PRs though.

I'm not sure what's happening in your second case. The example pages load the library from unpkg which seems to work as expected https://m90.github.io/seeThru/moving-alpha/

@m90 my bad i forgot to comment out the import when I tried the script version... so how hard would it to do a esm module version it just adding the export statement right and how fast can you have it in cdn? i can add a export statement in there... unless there mroe.

so you asking me to fork your project than add additional esm scripts to the project and do a merge request.. this would be my first despite how long I been on github.

To be honest I don't know how hard that would be as I'm not doing too much JavaScript anymore recently and have never really worked with ESM.

I would assume one would have to do the following:

  • "Rewrite" the script to be ESM (not too hard as it's a single file)
  • Adjust the build so that it creates an UMD version as well as an ESM version
  • Add necessary fields to package.json