StableLib / stablelib

A stable library of useful TypeScript/JavaScript code
https://www.stablelib.com
Other
173 stars 35 forks source link

CommonJS support (again!) #69

Closed damiensawyer closed 2 months ago

damiensawyer commented 2 months ago

Hi, please forgive me if I'm off piste with this question. I'm still working my way around commonj vs modules.

I'm wondering why a CJS version isn't included in your build output.

I've read this and it seems that you considered compiling to both but moved away.

My project is Typescript, using Jest. The Jest docs have a huge warning that module support is experiement. Also, according to state of JS, Jest is still king of the hill.

I've wrestled for 2 hours this morning trying to get stablelib modules working in our monorepo, but - and I guess it's me - I just can't get Jest to play nice.

I love TypeScript. I love modules. I love this project you've put together - but given the continued dependence by some popular tooling on CJS, would it be possible for StableLib to compile to both?

Sorry If I'm missing something obvious.

Thanks for listening to my rant :-)

damiensawyer commented 2 months ago

Forget all of that. I switched to Vitest and life is awesome. Good riddance to CommonJS.

dchest commented 2 months ago

Haha, yeah, CommonJS is pretty much dead, and those who wish to use it could use some bundler/preprocessor (or keep using 1.x versions of the StableLib packages).

I also had issues with Jasmine and Jest, so I switched to Vitest :D

damiensawyer commented 2 months ago

It makes me wonder why Jest has not only so much market share but also such positive community sentiment.

I guess that following the crowd isn't always a great idea.

I've been looking through the stablelib code today. It's a thing of beauty. Your attention to correctness is a real joy 😊 .

On Fri, 12 July 2024, 9:12 pm Dmitry Chestnykh, @.***> wrote:

Haha, yeah, CommonJS is pretty much dead, and those who wish to use it could use some bundler/preprocessor (or keep using 1.x versions of the StableLib packages).

I also had issues with Jasmine and Jest, so I switched to Vitest :D

— Reply to this email directly, view it on GitHub https://github.com/StableLib/stablelib/issues/69#issuecomment-2225351095, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGZTK6SF4Q7MS6UWNHH4SLZL623RAVCNFSM6AAAAABKX33JEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRVGM2TCMBZGU . You are receiving this because you modified the open/close state.Message ID: @.***>