Closed ihenckel closed 4 years ago
Mixing Preact 10 with preact-compat
which was written for Preact 8.x won't work as suggested by the opening paragraph in the README:
:rotating_light: Note: This module is for Preact 8.x and prior - Preact X includes compat by default. For Preact X, please uninstall preact-compat and replace your aliases with preact/compat.
In either case unpkg
doesn't follow the resolution standard correctly (see: https://github.com/preactjs/preact/issues/2564 ) so you'll be better of with more modern CDNs that do. https://pika.dev or https://npm.reversehttp.com are both an excellent choice.
Example with the latter:
<script type="module">
import * as React from "https://npm.reversehttp.com/preact@10.4/compat";
const app = React.createElement("div", null, "Hello World!");
React.render(app, document.getElementById("app"));
</script>
These instructions recommend:
However, this yields
See https://jsfiddle.net/jLf2mdpe/1/