elpheria/rpc-websockets

Target `esnext` when building releases

Closed this issue · 0 comments

Consumers of this package build for a variety of targets, from the most modern to the most deprecated. The choice of which target to build their application against rests with them, and them alone.

This library builds releases against a target too.

"target": "es2017",

The reason this is bad is because this process is lossy. If a consumer of this library wants to build for es2020, it's too late – you've already downcompiled rpc-websockets for es2017.

This steals away from your consumers bundle size optimizations, compatibility, and sometimes even performance. Consider this consumer for instance, whose customers can no longer use the software on the Vercel Edge runtime because you've downcompiled it to es2017: solana-labs/solana-web3.js#2595

The solution here is to compile rpc-websockets for the most modern target (esnext) and let your consumers' bundlers downcompile to whatever target is appropriate for their audience.