philcockfield / file-system-cache

A super-fast, promise based cache that reads and writes to the file-system.
MIT License
51 stars 14 forks source link

Working with oclif #53

Open jondewoo opened 1 month ago

jondewoo commented 1 month ago

Hi 👋🏼

I'm trying to use file-system-cache in an oclif project and encountering errors when importing and using the package in CJS and ESM contexts. I created two repro projects, https://github.com/jondewoo/oclif-vs-file-system-cache-cjs and https://github.com/jondewoo/oclif-vs-file-system-cache-esm, and also opened an issue detailing those errors on oclif's GitHub page: https://github.com/oclif/oclif/issues/1490

Thanks for your help!

philcockfield commented 1 month ago

Hi there @jondewoo - thanks for the issue report.

This is due to a PR (submitted by one of the core Storybook team) updating the project to only support ESM bundling.

I have updated this to a major v3 (as it is a breaking change) and on the whole feel we as an entire JS community should be moving to proper ESM support and ditching CJS. Major libraries started doing this a few years ago, the standard itself being ~10 years old. Back then it was a total PITA for me for me when major libraries started doing this, so I feel the pain.

You could lock your version to the 2.4.4 version.


NOTE: there is another related issue opened here: #52 that has a possible solution that causes ESM and CJS to play nicely together. I'm investigating this to get this unstuck for everyone. Apologies for the hassle....