Skip to content

Instantly share code, notes, and snippets.

@Comandeer
Created July 7, 2018 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Comandeer/fa6cad754937952170436f00d3fd2f65 to your computer and use it in GitHub Desktop.
Save Comandeer/fa6cad754937952170436f00d3fd2f65 to your computer and use it in GitHub Desktop.
Importing Object URI as ES Module
const myJSFile = new Blob( [ 'export default true;' ], { type: 'application/javascript' } );
const myJSURL = URL.createObjectURL( myJSFile );
import( myJSURL ).then( ( module ) => {
console.log( module.default ); // true
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment