> How would I remove all console.log from my code automatically during a build?
Make it a lint warning?
Add a higher-level logging abstraction and/or library?
I know Webpack and Esbuild both have ways to define symbols like `console` at build time and get dead code elimination. No Babel needed.
> How would I add syntactically nice things to JS?
What do you need in 2022?
I definitely understand that in 2014 there were a lot of nice polyfills and prollyfills to be found in the Babel ecosystem for syntax that made the language a lot nicer to work in, but in the last eight years, most of them are in the language itself now and supported in nearly every browser. ES2015+ has so much of that goodness baked in and every browser generally supports ES2015+ well (and so does Node, mostly). Most caniuse statistics says browsers are caught up to at least ES2020.
We are over and on the side of the hump that Babel helped collectively prepare us for.
Yes, there's still a usefulness there in testing future ideas and it will probably still always be a collaborative tool for helping with TC39 early stage testing of proposals. But at this point, should your Production builds really rely on anything before Stage 3 with TC-39?
For stuff in Stage 3+ there's always Typescript as an alternative to Babel.
> How would I get my environment variable values set for the build into the code, which is to be run in a browser?
You do that in Babel? I've never heard of anyone doing that Babel. I've seen all sorts of dynamic import strategies in Webpack and other builders. I've done some neat things with JSON files and sometimes builder imports and sometimes just good old fetch().