Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix feature detection for stable Pyodide 0.26 #2650

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/pyodide/internal/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,16 @@ async function instantiateEmscriptenModule(
// They used to have an `environment` setting that did this but it has been
// removed =(
// If/when we link our own Pyodide we can remove this.
// @ts-ignore
globalThis.window = {}; // makes ENVIRONMENT_IS_WEB = true
// @ts-ignore
globalThis.importScripts = 1; // makes ENVIRONMENT_IS_WORKER = false
const global = globalThis as any;
global.window = {}; // makes ENVIRONMENT_IS_WEB = true
global.document = { createElement() {} };
global.sessionStorage = {};
global.importScripts = 1; // makes ENVIRONMENT_IS_WORKER = false
const p = _createPyodideModule(emscriptenSettings);
// @ts-ignore
delete globalThis.window;
// @ts-ignore
delete globalThis.importScripts;
delete global.window;
delete global.document;
delete global.sessionStorage;
delete global.importScripts;
const emscriptenModule = await p;
return emscriptenModule;
} catch (e) {
Expand Down
Loading