Skip to content

Conversation

@simolus3
Copy link
Contributor

@simolus3 simolus3 commented Nov 3, 2025

This changes builds for powersync packages to make published libraries easier to debug:

  1. Unconditionally emit source maps (todo: test).
  2. Unconditionally disable minification. This seems to be what most other libraries are doing as well, users are likely to be running minifiers for prod builds anyway.
  3. Bundle fewer dependencies: Dependencies which don't require polyfills don't really need to be bundled. By not bundling them, there's a potential for reducing application code size if other packages also depend on PowerSync-dependencies (because the libraries would be de-duplicated in that case).

Listing all packages:

  • adapter-sql-js: Bundle our custom sql.js fork, no longer bundle async-mutex. Use source maps, non-minified builds.
  • attachments: Enable source maps.
  • capacitor: TODO
  • common:
    • We had to inject a TextDecoder polyfill when we were still using can-ndjson-stream. We're not doing that anymore, I've added a createTextDecoder() method on AbstractRemote that the react-native package can override. This avoids us having to bundle that polyfill on all platforms.
    • I've adopted conditional exports and a separate Node build to stop bundling the buffer package for Node (we can and should just use node:buffer instead).
    • We should bundle js-logger (because it's a legacy UMD module that's hard to integrate) and rsocket (because it references Buffer as a global and we need to rewrite that to imports). However, I don't see why we would want to bundle async-mutex, buffer or event-iterator. These don't seem to create any issues, and this marks them as external again.
    • Side-node: There's more work to be done here. For instance, we can stop depending on BSON after removing the legacy sync client. I also think we should look into only supporting WebSockets on React Native to not pay the rsocket cost for all SDKs.
  • drizzle-driver: Enable source maps.
  • kysely-driver: Enable source maps.
  • node: Replace async-locks with async-mutex (that package is already used in common).
  • powersync-op-sqlite: No changes necessary.
  • react: Enable source maps.
  • react-native: Enable source maps, disable minification.
  • tanstack-react-query: Enable source maps.
  • vue: Enable source maps.
  • web: Update dependencies.

TODOS:

  • Test packages.
  • Test vite web demo.
  • Test webpack web demo.
  • Test react native demo.
  • Test react native web demo.
  • Test node demo.
  • Test node electron demo.
  • Test pre-release / published packages to ensure source maps don't cause vite warnings.

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

🦋 Changeset detected

Latest commit: 84d33ce

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

This PR includes changesets to release 14 packages
Name Type
@powersync/tanstack-react-query Patch
@powersync/op-sqlite Patch
@powersync/adapter-sql-js Patch
@powersync/drizzle-driver Patch
@powersync/kysely-driver Patch
@powersync/react-native Patch
@powersync/diagnostics-app Patch
@powersync/attachments Patch
@powersync/capacitor Patch
@powersync/common Patch
@powersync/react Patch
@powersync/node Patch
@powersync/vue Patch
@powersync/web 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

@simolus3 simolus3 force-pushed the reduce-bundling branch 2 times, most recently from 4521834 to 6343bc0 Compare November 3, 2025 16:55
@simolus3 simolus3 marked this pull request as ready for review November 4, 2025 08:00
Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

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

🥳 This is very very nice. Glad to see these improvements.

I left some minor comments.

I did some basic smoke testing with the React Native and React Supabase Todolist apps. those seem to work fine 😄

@simolus3 simolus3 force-pushed the reduce-bundling branch 2 times, most recently from 711224c to eb3a81d Compare November 5, 2025 12:00
@simolus3 simolus3 merged commit 3e4a25c into main Nov 6, 2025
9 checks passed
@simolus3 simolus3 deleted the reduce-bundling branch November 6, 2025 11:25
@rkistner rkistner mentioned this pull request Nov 6, 2025
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