tursodatabase / tursodatabase/libsql-client-ts

Module parse failed: Unexpected token

Open
#127 1 comment 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

I have tried to use @libsql/client together with drizzle inside some new projects of mine, however I always get the following error, whatever I try.

Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
| 
| Copyright (c) 2023 libSQL

Import trace for requested module:
./node_modules/@libsql/client/LICENSE.md
./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js

At first I though the problem was using bun, but this also happens every time with npm and pnpm.

Rest of my project setup:

  • Next.js 13.5 / 14.0.1
  • bun 1.0.5
  • @libsql/client 0.3.6 (also tried 0.3.7-pre.2 to no success)

Usage of @libsql/client:

import { createClient } from "@libsql/client";
import { drizzle } from "drizzle-orm/libsql";

const connection = createClient({
  url: process.env.DATABASE_URL || "",
  authToken: process.env.DATABASE_AUTH_TOKEN,
});

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

Start with the reported import trace, especially node_modules/@libsql/client/lib-esm/node.js, node_modules/@libsql/client/lib-esm/sqlite3.js, and node_modules/libsql/index.js. Reproduce the failure in a minimal Next.js 13 or 14 project with the shown @libsql/client and drizzle imports using the listed package managers. Done means the project builds without the LICENSE.md module parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, next.js, typescript
Domain
build-system, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.