Created
October 4, 2019 18:10
-
-
Save vsimko/fd3c22dfbfb860440df2f5fb91c972f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://2ality.com/2019/10/eval-via-import.html | |
function esm(templateStrings, ...substitutions) { | |
let js = templateStrings.raw[0]; | |
for (let i=0; i<substitutions.length; i++) { | |
js += substitutions[i] + templateStrings.raw[i+1]; | |
} | |
return 'data:text/javascript;base64,' + btoa(js); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment