Do you think it's possible to load polyfills conditionally, as in:
if (
'startsWith' in String.prototype &&
'endsWith' in String.prototype &&
'includes' in Array.prototype &&
'assign' in Object &&
'keys' in Object
)
// avoid punishing modern browser users
return;
import("core-js/...")
The trick being that all of Next.js scripts would have to wait for this step to complete (either skipping polyfill loads or waiting for core-js imports to complete.
This was easy to do without Next, however, now it seems quite tricky.
Do you think it's possible to load polyfills conditionally, as in:
The trick being that all of Next.js scripts would have to wait for this step to complete (either skipping polyfill loads or waiting for
core-jsimports to complete.This was easy to do without Next, however, now it seems quite tricky.