Oclif and Vite
01/14/2024, Sun
Categories:
#shell
#typescript
Tags:
#NodeJs
Incompatibility with CLI Build
If you intend to build out an Oclif typescript CLI app that is to be consumed by Vitejs, you might experience an issue with integrating the two. The Oclif CLI builds properly, but when executing the CLI through vite, this errors comes up.
[ERR_UNKNOWN_FILE_EXTENSION] TypeError Plugin: ... [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" ...
There is an Oclif issue raised that suggests that Vite doesn't work with Oclif.
Since the issue hasn't been resolved as of January 2024, one can switch to using parceljs as the alternative. Parcel has a programmatic API for watching and serving content functionalities similar to Vite.
For additional file watching capabilities, look into the @parcel/ watcher package.