spectacle icon indicating copy to clipboard operation
spectacle copied to clipboard

One page: refactor to actual ESM

Open ryan-roemer opened this issue 1 year ago • 0 comments

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.

ryan-roemer avatar Jul 20 '22 17:07 ryan-roemer