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.
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?
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.
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.