powersync-js icon indicating copy to clipboard operation
powersync-js copied to clipboard

[Feature] Kysely CommonJs Export

Open stevensJourney opened this issue 1 year ago • 2 comments

Overview

This adds a CommonJS export for the @powersync/kysely-driver package. Previously only a ESM export was provided.

React Native typically transpiles import statements to require statements, but this might be fickle in some cases - potentially in React Native web.

How this works

See this for reference. The output of this module has changed to:

image

The cjs export will be used if the module is required e.g. const {} = require('@powersync/kysely-driver'). The ESM export will be used if the module is imported e.g. import {} from '@powersync/kysely-driver';

The CommonJS export is transpiled via an additional tsconfig.json file. The contents of this file use require statements for internal modules. This means this package will require CJS versions of those modules if they provide them. Kysely provides CJS exports.

stevensJourney avatar Aug 13 '24 07:08 stevensJourney

🦋 Changeset detected

Latest commit: b89c6628dd430d89cf10ac590e724b023d5eee88

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

This PR includes changesets to release 1 package
Name Type
@powersync/kysely-driver Minor

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

changeset-bot[bot] avatar Aug 13 '24 07:08 changeset-bot[bot]

This should help with https://github.com/powersync-ja/powersync-js/issues/262

stevensJourney avatar Aug 13 '24 07:08 stevensJourney

Closing this for now. The original purpose of this was to help support React Native web, but React Native web was incorrectly importing the kysely package (not this driver package).

stevensJourney avatar Sep 12 '24 11:09 stevensJourney