DEV Community

Discussion on: What JS Libraries Have You Made?

 
tamb profile image
Tamb

That's gonna be great. I've been fine with UMDing my libraries but ultimately it's annoying. TypeScript does cover that issue though, at least that's what I've found. Your markdown component is sick too! Nice stuff!

Thread Thread
 
evanplaice profile image
Evan Plaice

UMD is probably the best universal target until IE can be dropped.

I don't use TS for library dev but all my libs are TS compatible. I kinda hope TS overtakes Webpack for compilation b/c its output is a lot more faithful to the spec. ESM in webpack is pretty much just CommonJS w/ ESM syntax and a lot of Node-specific behavior.

Spec ESM is damn good. Tree-shaking to remove dead code works beautifully. The major downside is you can't use non-strict JS w/ modules so it'll obsolete a ton of older libraries. That and pre-ESM libs that yeet their namespace onto the global context are painful to integrate.

For lib dev I use JS to lower the barrier-to-entry for contributors, add JSDoc types that compile to TS typings for all the type checking/intellisense goodies, and ship CommonJS for Node backward compat. Tooling w/ ESM support (ex testing) is still lagging but that should get better as time goes on.

Thanks! The wc-markdown is my favorite of the collection. It's what loads all of the content on my personal website. Hopefullt, one day I'll finish that markdown-es parser so I can optimize the heck out of it.