[codex] fix Vitest Node WASM package export#1006
Merged
Merged
Conversation
Contributor
WASM Size Report
|
zxch3n
added a commit
that referenced
this pull request
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
loro-crdtpackage resolution for Node/Vitest bare imports by adding anodecondition before the rootimportcondition. This makes Node test runners resolve to the existingnodejsWASM entry instead of the bundler WASM entry.The bundler smoke tests now exercise a stronger Loro scenario across generated apps:
new Loro(),getMap(),ensureMergeableText(), text insertion, andtoJSON()verification. A newvitest-nodesmoke case covers the issue #1005 path by installingloro-crdtinto a temporary Vitest project and importing it by package name fromnode_modules.Root Cause
loro-crdt@1.13.0added conditional exports where ESMimportresolved to./bundler/index.js. Vitest externalizes dependencies innode_modules, so Node loaded the bundler WASM entry directly and hitundefined.memoryduring WASM startup. The Node-specific package condition should resolve to the Node entry before the genericimportcondition.Validation
node --check examples/bundler-smoke-tests/scripts/run.mjsnode --check examples/bundler-smoke-tests/scripts/browser-runtime.mjsnode --check examples/bundler-smoke-tests/scripts/dev-runtime.mjsLORO_SMOKE_PACKAGE=loro-crdt@1.13.0 pnpm --dir examples/bundler-smoke-tests run test vitest-nodeloro-crdtresolves tonodejs/index.jsand the Vitest test passespnpm exec vite buildin the generatedvite7smoke project still emits the browser WASM assetpnpm --dir examples/bundler-smoke-tests exec node ./scripts/browser-runtime.mjs vite7passes with{"map":{"text":"mergeable-smoke"}}