Skip to content

Fix WASM bundler compatibility#976

Merged
zxch3n merged 1 commit into
mainfrom
feat/loro-975
May 3, 2026
Merged

Fix WASM bundler compatibility#976
zxch3n merged 1 commit into
mainfrom
feat/loro-975

Conversation

@lodyai
Copy link
Copy Markdown
Contributor

@lodyai lodyai Bot commented May 3, 2026

Summary

  • add a browser package remap for Loro WASM glue so browser bundlers avoid the bundler .wasm static import path
  • add a synchronous browser glue target and include browser artifacts in the published packages
  • make the base64 entry friendlier to esbuild, Rollup, and Next Webpack by removing browser-visible Node builtin requires and top-level await
  • add bundler smoke tests covering Vite 5/6/7/8, rolldown-vite, Webpack 5, Rsbuild 2, Rspack 2, Parcel 2, esbuild, Rollup, and Next 16 Turbopack/Webpack

Fixes #975

Validation

  • node --check examples/bundler-smoke-tests/scripts/run.mjs
  • node --check crates/loro-wasm/scripts/browser_patch.js
  • pnpm dlx deno check --no-lock crates/loro-wasm/scripts/post-rollup.ts
  • pnpm --dir examples/bundler-smoke-tests run list
  • LORO_SMOKE_PACKAGE=loro-crdt@1.12.1 pnpm --dir examples/bundler-smoke-tests run test rolldown-vite (confirmed old package fails)
  • LORO_SMOKE_PACKAGE=file:/tmp/loro-975-smoke-pkg/loro-crdt-patched pnpm --dir examples/bundler-smoke-tests run test rolldown-vite
  • LORO_SMOKE_PACKAGE=loro-crdt@1.12.1 pnpm --dir examples/bundler-smoke-tests run test esbuild-base64 (confirmed old package fails)
  • LORO_SMOKE_PACKAGE=file:/tmp/loro-975-smoke-pkg/loro-crdt-patched pnpm --dir examples/bundler-smoke-tests run test esbuild-base64 rollup-base64 esbuild-default-copy rollup-default-copy
  • LORO_SMOKE_PACKAGE=file:/tmp/loro-975-smoke-pkg/loro-crdt-patched pnpm --dir examples/bundler-smoke-tests run test next16-webpack
  • git diff --check

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

WASM Size Report

  • Original size: 3092.65 KB
  • Gzipped size: 991.97 KB
  • Brotli size: 690.99 KB

@zxch3n zxch3n merged commit cc587ed into main May 3, 2026
1 check passed
@zxch3n zxch3n deleted the feat/loro-975 branch May 3, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bundler entry deadlocks Vite/Rolldown production builds (top-level await + circular wasm wrapper)

1 participant