WebReflection / uhtml

A micro HTML/SVG render

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider bringing global `uhtml` export back

greentore opened this issue · comments

I understand your pro esm stance and therefore I won't mind if you just close this issue.
I'm asking for this because I'm using your library to render UI in userscripts, which can only consume @required dependencies by using their global export. The alternative would be bundling the dependencies directly, but it would obscure the script proper, which is kept readable for transparency reasons.

you can always do this:

import * as uhtml from 'https://cdn.jsdelivr.net/npm/uhtml/keyed.js';
globalThis.uhtml = uhtml;

or you can always require the uhtml but I don't know what kind of tools you are using.

You can also publish your global-uhtml npm module where you basically just do exactly what I've already suggested:

import * as uhtml from 'uhtml/keyed';
globalThis.uhtml = uhtml;

you bundle that and publish its artifact ... so I think we should be be good? Closing as I have no intention to add back the global, specially because I'd need 3 globals: base, keyed, init ... it's not going to happen.