Skip to content

Instantly share code, notes, and snippets.

Embed
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;
}
};
hasDynamicImport();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.