-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hey there, this is a neat project and could hopefully someday do away with needing ts-node for everything.
I want to open this as more of a TO-DO for when I or someone else finds time. Right now I'm using yarn2, which uses a virtual filesystem and doesn't have a node_modules folder. All packages are instead stored in .zip files and extracted when needed.
A few takeaways from my hour trying to get this to work with yarn2.0.0-rc.29 and node 13.9:
-
It looks like this package depends on there being a node_modules folder, so that'd need to be dealt with
-
Yarn2's virtual filesystem is accessible via a few different routes but the simplest is by starting node as
node --require ./.pnp.jsfrom the project root. Delving into exactly what happens when.pnp.jsis hooked like this is a big TODO, but I believe it monkeypatches thefsmodule to automatically unzip packages whenever they're imported / required.The catch22 with using yarn2 + this neat package is:
- When
package.jsonhas"type": "module",requireis not defined at startup. Since the CLI flag--require ...seems to literally userequire(...), this fails with an error. - Without
--require ./.pnp.js, none of the workspace's packages are available, meaning--loader=@k-foss/ts-esnoderesults inCannot find package '@k-foss/ts-esnode ...
- When
So maybe sometime later this month I'll have some bandwidth to tackle this. But compliments again for finding a way to leverage these new node features to potentially make typescript less painful.