Closed nuthinking closed 2 years ago
The README.md explicitly calls this out: https://github.com/Pomax/lib-font#tddr
Ops, I thought that because it was a bundle it didn't need to be a module. Sorry about that!
@Pomax if I add the type attribute as module
I then get: Failed to resolve module specifier 'zlib'
. Thanks!
Heh, also called out in the README.md but probably not as obvious: https://github.com/Pomax/lib-font#why-dont-woffwoff2 since browsers (frustratingly) don't come with a convenient Compression
object even though they fully support deflate/inflate, zip/unzip, and brotli/unbrotli because of server compression, so there's two helper libraries that you can load.
For "complete" functionality:
<!doctype html>
<html>
<head>
...
<script src=".../lib/inflate.js" defer></script>
<script src=".../lib/unbrotli.js" defer>script>
<!-- and then make index import from "lib-font.browser.js" -->
<script src=".../index.js" type="module" async></script>
</head>
<body>
...
</body>
</html>
When loaded or embedded as a simple script (not
module
) it throws:lib-font.browser.js:1 Uncaught SyntaxError: Unexpected token 'export' (at lib-font.browser.js:1:81241)