DEV Community

Discussion on: Bringing Modern JavaScript to Libraries

Collapse
 
y_nk profile image
Julien Barbay • Edited

Honestly TLDR but by glancing I cannot stress enough how bad is a world where you need to build an application for "js2020", "js2019", "js2018", "js2017" and so on. Soon enough we'll have the division of python 2/3 in the javascript world in libraries.

"We’ve left transpilation to package authors, but have established no mechanism for them to publish a modern version of their code."

Here you have the solution of your problem : just don't transpile libraries. Serve them fresh with the latest tc39 stable features and don't assume how people want to consume them. If they want to transpile down to es5, let them do. If some library author publishes a library with older javascript features, it'll work as much thanks to backward compatibility.

Don't assume on how people will use your code. Serve it clean no matter what. Problem solved.