aidenybai / million

Optimize React performance and make your React 70% faster in minutes, not months.
https://million.dev
MIT License
16.26k stars 574 forks source link

bug: instructions on https://millionjs.org/docs/api/extra/morph doesn't work #272

Closed yatesco closed 2 years ago

yatesco commented 2 years ago

Describe the bug The example from https://millionjs.org/docs/api/extra/morph doesn't work because it cannot find the morph function.

To Reproduce

  1. create a html page
  2. copy and paste the script example from https://millionjs.org/docs/installation
  3. replace the contents with https://millionjs.org/docs/api/extra/morph taking care to use the full URL for the import
  4. run in Chrome
  5. see the JavaScript error in the console

Expected behavior Examples should be copy-and-pasteable ;-)

Additional context Looking at the other extensions, it seems there are additional files that might be needed, so I guessed at the following:

import { m, patch, createElement } from "https://cdn.skypack.dev/million";
import { morph } from "https://cdn.skypack.dev/million/morph"; // GUESS
alert("million"); // THIS WORKS
const node1 = document.createElement("div");
const node2 = document.createElement("div");
node2.textContent = "Hello World";

morph(node2, node1); // THIS FAILS

morph("<div>Goodbye World</div>", node2);
aidenybai commented 2 years ago

Hey! Sorry for the late response. On this issue now

aidenybai commented 2 years ago

Fixed in #274

yatesco commented 2 years ago

Thanks @aidenybai