Closed joshuaquek closed 4 years ago
So I had a go at this myself (as it is something I'd like to support) and it turns out that you cannot use the import
keyword inside of eval()
or new Function()
. But what we can do instead (and this might sound crazy but it works) is base64 encode the setup code and test cases, then use that as a data url for an iframe.
This will allow us to use both static and dynamic imports and help sandbox test cases.
This is now supported (was included in #24) thanks to worker type module which landed in chrome recently. You can now use top level await or es-module import syntax.
Hope this helps, apologies it took so long to implement! 🙇
Let's say that I want to import lodash and underscore just to compare each one's performance, is there a way to do it?
I've tried:
and
but neither work (obviously).
Is there any way to include external modules?
Lodash is also available minified here: https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js
...maybe we can allow including of external modules?