apify / apify-storage-local-js

Local emulation of the apify-client NPM package, which enables local use of Apify SDK.
3 stars 4 forks source link

fix: resolved an issue where types were not being properly picked up in some ESM TS projects (resolves #62) #64

Closed ClockRide closed 4 months ago

ClockRide commented 4 months ago

Resolves https://github.com/apify/apify-storage-local-js/issues/62.

I found that this package was causing type errors in my application. The proposed solution is the least intrusive I have found. I considered overhauling the bundling pipeline altogether using something like Rollup. While it seems to be a better way of achieving ESM+CJS compatibility, it could present breaking changes and have all kinds of side effects, so I opted for patching package.json instead.

References: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md (In-Depth about "Masquerading as CJS" problem) https://github.com/microsoft/TypeScript/issues/52363#issuecomment-1659179354 (TL;DR solution)