Skip to content

Conversation

@stevensJourney
Copy link
Collaborator

Overview

Some changes introduced in #753
unintentionally caused breakages for consumers using Vite’s development build process.

That refactor externalised event-iterator and buffer for non-Node.js builds of @powersync/common. As a result, Vite dev servers can fail with errors such as:

The requested module '/@fs/private/tmp/example-vite/node_modules/buffer/index.js?v=7f9815bf' does not provide an export named 'Buffer'

and

SyntaxError: The requested module '/@fs/private/tmp/example-vite/node_modules/event-iterator/lib/dom.js?v=9b401c16' does not provide an export named 'EventIterator'

While consumers can work around this by updating their Vite configs, requiring manual configuration changes is potentially a breaking change. For example:

optimizeDeps: {
  // Don't optimize these packages as they contain web workers and WASM files.
  // https://github.com/vitejs/vite/issues/11672#issuecomment-1415820673
  exclude: ["@journeyapps/wa-sqlite", "@powersync/web"],
  include: [
+    "@powersync/web > event-iterator",
  ],
},
plugins: [wasm(), topLevelAwait()],
worker: {
  format: "es",
  plugins: () => [wasm(), topLevelAwait()],
},
+resolve: {
+  alias: {
+    buffer: "buffer",
+  },
+},

This PR reverts the externalisation to prevent consumers from running into these issues.

This problem didn’t surface within the monorepo because of how our package structure behaves during local development. To prevent regressions going forward, the isolated tests have been expanded to include Vite unit tests for the example-vite demo. These tests run against a real Vite dev server and will fail with the same errors if the configuration becomes invalid again.

@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: 63f5a38

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@powersync/common Minor
@powersync/react-native Minor
@powersync/web Minor
@powersync/adapter-sql-js Patch
@powersync/node Patch
@powersync/op-sqlite Patch
@powersync/tanstack-react-query Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

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

@stevensJourney stevensJourney marked this pull request as ready for review November 20, 2025 13:35
@stevensJourney stevensJourney merged commit 507197f into main Nov 20, 2025
13 of 15 checks passed
@stevensJourney stevensJourney deleted the revert-event-emitter branch November 20, 2025 14: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.

3 participants