Skip to content

Instantly share code, notes, and snippets.

@Quixomatic
Last active October 9, 2020 12:42
Show Gist options
  • Save Quixomatic/8b913a85d4c770298f8aebce404fd9b4 to your computer and use it in GitHub Desktop.
Save Quixomatic/8b913a85d4c770298f8aebce404fd9b4 to your computer and use it in GitHub Desktop.
JAVASCRIPT: Dynamically import something in es6
const getAsyncImport = async () => {
try {
const dynamicThing = 'faCoffee';
const something = await import(`/${dynamicThing}`);
console.log(something);
} catch (error) {
alert('it did not import properly!');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment