syncpack icon indicating copy to clipboard operation
syncpack copied to clipboard

fix(types): support importing types into CJS projects

Open moltar opened this issue 1 year ago • 3 comments

Description

Going from 12.3.0 -> 12.3.1 introduced a breaking change (going ESM).

I had a CJS package that depended on the types from syncpack, and I cannot build it due to this change.

Suggested Solution

Option 1: Publish types separately, e.g. @syncpack/types.

Option 2: Dual publish CJS/ESM package (e.g. using tsup).

Help Needed

N/A

moltar avatar Apr 27 '24 11:04 moltar

No worries @moltar, I did think about this and ultimately went the way I did given syncpack is a CLI rather than a library. It's a fair point though, I'll have a think about what can be done for you, thanks!

JamieMason avatar Apr 27 '24 16:04 JamieMason

In the meantime, I just learned about https://github.com/unjs/jiti which might serve as a workaround.

JamieMason avatar May 11 '24 08:05 JamieMason

Jiti is a great project. But I think because it uses require, it wouldn't benefit my case, as I am actually just interested in the types. I use these types to build up a config object programmatically.

moltar avatar May 11 '24 09:05 moltar