#How to Add a Polyfill for the Array at() Method in a Vite Project?
1 messages · Page 1 of 1 (latest)
In Vite, you can use @vitejs/plugin-legacy (https://www.npmjs.com/package/@vitejs/plugin-legacy), and enable the modernPolyfills option, and disable the renderLegacyChunks option, so you only get the polyfills for it.
It doesn't work well for frameworks though, like Nuxt. It may have its own ecosystem for injecting polyfills
thks,I try your solved way.
the way don‘t sovled question. I want question is core-js or other polyfill script . But I didn't research which polyfill script they used.
the plugin will generate a polyfill script, but only in builds fyi. You can also use https://polyfill.io if you like
great. I'll check it out.👍
I solved this question. just need add polyfills: ['es.array.at']. at your config of legacy plugin
Is this the recommended way to polyfill ES2023 in Vite today?