与 Deno 一起使用

Deno is an alternate TypeScript/JavaScript runtime, similar to NodeJS, but has built-in TypeScript support and is not intantly compatable with most npm packages.

So to run XState on Deno, you need to import it differently, via Skypack. Packages are ‘installed’ at runtime; no more /node_modules!

  1. import { createMachine } from 'https://cdn.skypack.dev/xstate';

You can see it in action here.