Skip to content

Instantly share code, notes, and snippets.

@chill-cod3r
Created March 28, 2022 02:30
Show Gist options
  • Save chill-cod3r/e24656060e40426ea1aa7082df83e50e to your computer and use it in GitHub Desktop.
Save chill-cod3r/e24656060e40426ea1aa7082df83e50e to your computer and use it in GitHub Desktop.
Hacky typescript esmodule commonjs interop dynamic import
export const dynamicImport = (packageName: string) =>
new Function(`return import('${packageName}');`)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment