Circular dependency in lib/get-format.js
brawaru opened this issue ยท 1 comments
Heyo! Thanks so much for maintaining this package, it's been incredibly useful so far (while Node.js is still keeping this feature experimental) ๐๐ป
Unfortunately I have hit an error today with jiti package (when used in Nuxt, but more precisely it's coming from c12
that Nuxt uses to load configurations). The error caused by the circular dependency in lib/get-format.js
, because of it jiti gets stuck in a recursion until it errors out due to exceeding the stack size.
It would've been a relatively simple change to fix it โ just to move the getPackageType
into its own file, but as I understand from the comments in code, you grab the code directly from Node.js. I'm a bit worried that I'm in no capacity to contribute that directly to Node.js, and creating an issue about that probably won't bring fix any soon (although I may try), but I really need that fixed (currently using pnpm patching, but that's not a solution you can ship to package consumers).
So I'm wondering if you would be okay with accepting a PR with the above commit if I were to submit it?
Hi! Yeah, code is ported from Node, manually.
I am open to fixing this by splitting stuff into a new file, so long as there are very clear comments about what's different from Node and why!