Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default export for deno? #1789

Open
davesteinberg opened this issue Oct 15, 2024 · 0 comments
Open

Update default export for deno? #1789

davesteinberg opened this issue Oct 15, 2024 · 0 comments

Comments

@davesteinberg
Copy link

Deno 2 seems to fully support libsql's node client. Would it make sense to update the . export for deno so users get the node client by default?

Or is the intent that Deno users should explicitly import from @libsql/client/node if that's what they want?

I've encountered a problem with Drizzle, which is that it does the import for you, and it just imports from @libsql/client. It doesn't provide any mechanism to request the node or web client specifically. So using a file: DB URL simply does not work with Drizzle on Deno.

It definitely seems like a problem, but it's not clear to me where it should be fixed. So, I've asked about it over there, and now I'm asking here, as well.

Another possible solution could be for the user to specify a custom condition, though Deno doesn't support that yet. Even if/when it does, I think libsql's exports would have to be defined differently for that to work, since currently there's no higher-priority condition than deno you could specify that would give you the node client. I suppose something as simple as this could work?

    "exports": {
        ".": {
            "types": "./lib-esm/node.d.ts",
            "import": {
                "web": "./lib-esm/web.js",
                "node": "./lib-esm/node.js",
                "default": "./lib-esm/web.js"
            },
            "require": "./lib-cjs/node.js"
        },

I believe this would give you the same default on all runtimes, but you could specify "web" on Node or specify "node" elsewhere to get the non-default option.

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

No branches or pull requests

1 participant