Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: load worker from url again (#960)

Myles Scolnick189024921dcf
diff --git a/frontend/src/core/pyodide/bridge.ts b/frontend/src/core/pyodide/bridge.ts
index f067450e56..36c902a5f3 100644
--- a/frontend/src/core/pyodide/bridge.ts
+++ b/frontend/src/core/pyodide/bridge.ts
@@ -35,7 +35,6 @@ import { PyodideRouter } from "./router";
import { Paths } from "@/utils/paths";
import { getMarimoVersion } from "../dom/marimo-tag";
import { getWorkerRPC } from "./rpc";
-import InlineWorker from "./worker/worker?worker&inline";
export type BridgeFunctionAndPayload = {
[P in keyof RawBridge]: {
@@ -55,24 +54,17 @@ export class PyodideBridge implements RunRequests, EditRequests {
constructor() {
if (isPyodide()) {
- // Create a worker, try by URL then inline
- let worker: Worker;
- const version = getMarimoVersion();
- if (window.Worker) {
- try {
- worker = new Worker(new URL("worker/worker", import.meta.url), {
- type: "module",
- /* @vite-ignore */
- name: version,
- });
- } catch {
- Logger.debug("Failed to create worker by URL, trying inline.");
- worker = new InlineWorker({ name: version });
- }
- } else {
- Logger.debug("Worker not available, using inline worker.");
- worker = new InlineWorker({ name: version });
- }
+ // Create a worker
+ const worker = new Worker(
+ // eslint-disable-next-line unicorn/relative-url-style
+ new URL("./worker/worker.ts", import.meta.url),
+ {
+ type: "module",
+ // Pass the version to the worker
+ /* @vite-ignore */
+ name: getMarimoVersion(),
+ },
+ );
// Create the RPC
this.rpc = getWorkerRPC(worker);