Re:Rust Is the Future of JavaScript Infrastructure
by acemarke on Thursday November 11, 2021 @03:42PM
(#29192893)
There's many reasons to have a JS compilation step:
- Still targeting legacy browsers like IE11
- Using React / JSX syntax
- Using TypeScript
- Using other brand-new JS syntax that hasn't trickled out to wider support yet
- Using custom JS transforms for libraries like `styled-components` (see this Next.js discussion thread for examples of the many different non-standard Babel transformations that people are using: https://github.com/vercel/next.js/discussions/30174 )
That said, the ideal target language version _is_ getting better. Jason Miller ( creator of Preact) has done a lot of research on both browser support for ES2017, as well as tooling to reverse-compile ES5-targeted published libraries upwards to ES2017 syntax again for improved bundle size:
- Still targeting legacy browsers like IE11
- Using React / JSX syntax
- Using TypeScript
- Using other brand-new JS syntax that hasn't trickled out to wider support yet
- Using custom JS transforms for libraries like `styled-components` (see this Next.js discussion thread for examples of the many different non-standard Babel transformations that people are using: https://github.com/vercel/next.js/discussions/30174 )
That said, the ideal target language version _is_ getting better. Jason Miller ( creator of Preact) has done a lot of research on both browser support for ES2017, as well as tooling to reverse-compile ES5-targeted published libraries upwards to ES2017 syntax again for improved bundle size:
- https://jasonformat.com/enabling-modern-js-on-npm/
- https://web.dev/publish-modern-javascript/