Vite is the next generation frontend tooling.
Automatic Polyfill for Modern Browsers With Vite
Vite is a modern tool for frontend development. One of Vite’s functionalities is to deploy the app for production, including bundling all JavaScript (JS) files. Although Vite supports building for a particular browser target, it only transforms syntax with the help of ebuild, but does not perform any JavaScript polyfill. However, polyfill is essential for many projects. On the one hand, manual polyfill can be error-prone. On the other hand, an on-demand polyfill service like polyfill.io bears its own limitations and security risks. It is ideal to use a polyfill mechanism that is integrated with Vite. In this post, we discuss how to automatically polyfill JavaScript APIs in a Vite project with the help of the Vite legacy plugin. ...