Skip to content

Conversation

@stevensJourney
Copy link
Collaborator

Fix TanStack DB Demo Module Resolution & Add E2E Tests

Problem

The TanStack DB demo fails to run with pnpm dev, showing the following error:

✘ [ERROR] Could not resolve "@powersync/common"

    ../../node_modules/@tanstack/powersync-db-collection/dist/esm/schema.js:1:27:
      1 │ import { ColumnType } from "@powersync/common";
        ╵                            ~~~~~~~~~~~~~~~~~~~

Root Cause

This is caused by pnpm's package hoisting behavior in the monorepo:

  1. @tanstack/powersync-db-collection is hoisted to the root node_modules folder
  2. It declares @powersync/common as a peer dependency
  3. The demo had @powersync/common as a direct workspace:* dependency, which symlinked it to the demo's node_modules only
  4. When Vite/esbuild bundles @tanstack/powersync-db-collection from the root, it cannot resolve @powersync/common because it's not present at the root level

Solution

Remove the direct @powersync/common dependency from the demo. The package is already available transitively through @powersync/web, which resolves the hoisting issue.

Additional Changes

Added end-to-end tests for the demo that run outside of the monorepo context. These tests:

  • Verify the demo loads correctly in a Vitest browser mode session
  • Perform basic mutations and validate that TanStack DB detects and renders the changes correctly

@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2025

⚠️ No Changeset found

Latest commit: ef6fcb7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@stevensJourney stevensJourney marked this pull request as ready for review December 12, 2025 08:37
@Chriztiaan
Copy link
Contributor

Tested this on my side, happy with the changes.

Chriztiaan
Chriztiaan previously approved these changes Dec 12, 2025
Copy link
Contributor

@LucDeCaf LucDeCaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it, looks good to me.

@stevensJourney stevensJourney merged commit 8bf5fd7 into main Dec 12, 2025
9 checks passed
@stevensJourney stevensJourney deleted the tanstack-db-demo-update branch December 12, 2025 11:08
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.

4 participants