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(frontend): load loro wasm asynchronously in production builds (#11117)

Kiran Gadhave65c5cac8ccf6
diff --git a/frontend/vite.config.mts b/frontend/vite.config.mts
index cd7a5d6b15..89e27b51e8 100644
--- a/frontend/vite.config.mts
+++ b/frontend/vite.config.mts
@@ -317,6 +317,14 @@ export default defineConfig({
"react-dnd-html5-backend",
"dnd-core",
],
+ alias: [
+ // The default `browser` export of loro-crdt loads its wasm with a
+ // synchronous XMLHttpRequest at module evaluation. A page served with
+ // `Permissions-Policy: sync-xhr=()` blocks that request, and the
+ // editor fails to load. The bundler entry loads the wasm with an
+ // asynchronous fetch instead.
+ { find: /^loro-crdt$/, replacement: "loro-crdt/bundler" },
+ ],
},
worker: {
format: "es",