Update script.module immediately, so we avoid accidentally evaling the same module several times

This commit is contained in:
Heikki Aitakangas 2019-05-25 21:20:24 +03:00 committed by danielyxie
parent c485fdfa87
commit eecb0c0f01

@ -26,9 +26,9 @@ export async function executeJSScript(scripts = [], workerScript) {
// load fully dynamic content. So we hide the import from webpack
// by placing it inside an eval call.
urlStack = _getScriptUrls(script, scripts, []);
script.module = await eval('import(urlStack[urlStack.length - 1])');
script.module = new Promise(resolve => resolve(eval('import(urlStack[urlStack.length - 1])')));
}
loadedModule = script.module;
loadedModule = await script.module;
let ns = workerScript.env.vars;