Skip to content
loading...

Deno dependencies, xstate

adam_cyclones profile image Adam Crockett github logo ・1 min read  

I have been playing with deno again lately, seems like it's come quite far now. But what I am wondering about is using libraries.

I would love to use xstate but I'm not sure if xstate needs to be packaged in some special way for deno. How would I import it into my code?

twitter logo DISCUSS (3)
Discussion
markdown guide
 

Packages would need to be valid ES6 modules. I guess you'll have to rely on cdn like unpkg or pika.dev.

Using pika.dev cdn and xstate as an example, I think you'll have to do this.

import { Machine, interpret } from 'https://cdn.pika.dev/xstate@^4.7.7';

The deno manual has a section on using third party code: link

 

Thanks that's a great help, what about type defs? (Will read link)

 

If you use pika.dev you don't have to do anything to get the type definitions. According to this article.

In collaboration with the Deno team for their recent v0.32.0 release, Pika CDN now hosts type declarations for every package that provides them! Import an npm package from our CDN and Deno will automatically fetch its type declarations along with it.

The manual also has a external type definition section: link

Classic DEV Post from Jul 26 '19

🎩 JavaScript Enhanced Scss mixins! 🎩 concepts explained

In the next post we are going to explore CSS @apply to supercharge what we talk about here....

Adam Crockett profile image
I work at ForgeRock as a Front End Engineer, I play with all sorts really. Lately WASM is my toy of interest.