Quick Error Fix: libsql not parsing it’s files within node_modules


Next.js with Turso, when building we may run into a parsing error which would be:

Failed to compile.
./node_modules/.pnpm/@libsql+client@0.9.0/node_modules/@libsql/client/README.md
Module parse failed: Unexpected token (1:0)
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
> <p align="center">
|   <a href="https://docs.turso.tech/sdk/ts/quickstart">
|     <img alt="Turso + TypeScript" src="https://github.com/tursodatabase/libsql-client-ts/assets/950181/5d3a2693-75f9-4c56-9107-8ccaa96785fd" width="1000">

A “band-aid” solution to this is to change your next.config.js to parse the parse the files.

A more permanent solution is to change the way and location which you are instantiating drizzle, see in this GitHub comment.

Change the imports of Drizzle, see in this GitHub comment.

Another fix could be that you are not marking the appropriate files as
use server’ discussed here.

Getting Ahead: Your first 2,000 dollars on Upwork

$4.99

Are you a developer dreaming of location independence and a lucrative career? This ebook is your roadmap to success on Upwork, one of the world’s leading freelance platforms. Whether you’re a seasoned coder or just starting out, we’ll guide you through the most effective strategies to reach that crucial $2,000 milestone.

Category:

Leave a Reply