DEV Community

Discussion on: I created my first TypeScript library and published it on NPM

Collapse
 
jwp profile image
John Peters

Thanks for excellent article and background.

Do you think creating npm modules from Typescript is tedious?

Why was UMD the winner?

Are there easier ways if we just stick to esm2015?

Collapse
 
learosema profile image
Lea Rosema (she/her) • Edited

Of course, I'd favorize ESM over UMD but I've had some issues using ESM. So, I stuck to UMD for now.

Main reason: Coding playgrounds like JSFiddle or CodePen. Although you can use ESM in Codepen, it does not work as soon as you select some sort of transpiler for your code (Babel, TypeScript, Coffeescript, ...). To get it work with TypeScript, you will need to include the script as an UMD module in the settings panel.

Also, the LTS version of node still displays the ExperimentalWarning.

I guess as soon it is safe to get rid of the UMD build, things may get easier.

Collapse
 
jwp profile image
John Peters

Would you agree the whole JavaScript module system is a mess?

Angular has it's decorator class ngmodule which works but it seems difficult because error messages are very bad.