spectacle
spectacle copied to clipboard
One page: refactor to actual ESM
Background
Currently we use a UMD dist for Spectacle in a browser because EMS/import
doesn't work with React and other CJS-only transitive dependencies.
Idea
Use import maps / https://github.com/guybedford/es-module-shims to do just the spectacle imports from es
not dist
and put in a global. Then access from later script in real JS. This allows us to minimize shimmed script
tags (which are eval'ed by the shim first, and are not straight actual JS).
Then get rid of dist
.
Why?
Allows us to get rid of UMD bundle that's not widely used. Browers will eventually support import maps and this allows us to do an intermediate step that doesn't have too much of non-actual-code script
tags.