Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
dynamic import feature detection
function hasDynamicImport() {
try {
const f = new Function( 'x', 'return import("foo")' );
return true;
} catch ( err ) {
if ( err instanceof SyntaxError ) {
return false;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment