Merge pull request #326 from tidalcycles/eval-fix-node

fix: workaround Object.assign globalThis
This commit is contained in:
Felix Roos 2022-12-28 14:44:30 +01:00 committed by GitHub
commit 2ceafe6379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,14 @@ export const evalScope = async (...args) => {
console.warn(`evalScope: module with index ${i} could not be loaded:`, result.reason);
}
});
Object.assign(globalThis, ...modules);
// Object.assign(globalThis, ...modules);
// below is a fix for above commented out line
// same error as https://github.com/vitest-dev/vitest/issues/1807 when running this on astro server
modules.forEach((module) => {
Object.entries(module).forEach(([name, value]) => {
globalThis[name] = value;
});
});
};
function safeEval(str, options = {}) {