How do I add a regular TS package to a project? #617
-
I initialized a project with vscode, and I am trying to add a package (@xstate/fsm) to my project but I keep getting the following two errors when I try and import from it in
I know the package is already written in typescript and exports the types. Is there a special way that I should import a package? I did a simple |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Okay here is where I am at currently; not any package/library can be imported into a devicescript project, only devicescript packages will work. So in order to make that work I have to port the existing library over? |
Beta Was this translation helpful? Give feedback.
-
Oh for sure on the size, this one is listed at 1kb so I thought it would be okay, but I figured it out and have a plan; the actual npm package is the built version and doesn't actually include the ts so I am working on a linked port based off the original repo vs the compiled version, and then I can include that and boop the version if it falls behind. |
Beta Was this translation helpful? Give feedback.
Yes currently this is correct. It is most likely that the libraries you are trying to use will be slightly incompatible; or too big and just not adapter to run on embedded. Therefore, -- for now --, we require people to import "devicescript - optimzied" libraries. It's a bit of a hassle and maybe it could be relaxed but it is what it is at this point.
Code size, memory usage, ... are all concerns that are very much more important on embedded than in the browser/node.