tursodatabase / tursodatabase/libsql-client-ts

libsql-wasm with expo router

Open
#276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
576
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am currently using libsql on my Expo/React Native project. It works fine with native code, however, I aim to use libsql Wasm for the web version. I am encountering the error: Uncaught SyntaxError: Cannot use 'import.meta' outside a module.

The error points to:

  var sqlite3InitModule = (() => {
    var _scriptDir = import.meta.url;

Here is an example for reference:

import { createClient } from "@libsql/client-wasm";
const client = createClient({
  url: "file:local.db",
});

I suspect the issue could be related to metro bundling, any idea ?

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Expo/React Native web example using @libsql/client-wasm and createClient, then inspect how Metro or Expo Router bundles the generated sqlite3InitModule code containing import.meta.url. Done means the web version loads without the “Cannot use import.meta outside a module” syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript, wasm
Domain
build-system, frontend, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.