Giter Club home page Giter Club logo

Comments (5)

jackgrebenc avatar jackgrebenc commented on June 13, 2024

+1 - Experiencing the same issue trying to use this Turso package in my Next.js project

from libsql.

deckchairlabs avatar deckchairlabs commented on June 13, 2024

Also experiencing this issue

from libsql.

AlexanderHott avatar AlexanderHott commented on June 13, 2024

+1

I think the regex ./node_modules/@libsql/ ./node_modules/@libsql/ sync ^\.\/.*$ is catching the .md file and trying to parse it as something that isn't markdown

from libsql.

joshxfi avatar joshxfi commented on June 13, 2024

+1, I'm on a monorepo setup with turborepo


Drizzle ORM setup with Turso in packages/db

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

const client = createClient({
  url: process.env.TURSO_CONNECTION_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
});

export const db = drizzle(client);

When I import db to page.tsx in apps/web, I get the error:

web:dev: Module parse failed: Unexpected token (1:0)
web:dev: 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
web:dev: > <p align="center">
web:dev: |   <a href="https://docs.turso.tech/sdk/ts/quickstart">
web:dev: |     <img alt="Turso + TypeScript" src="https://github.com/tursodatabase/libsql-client-ts/assets/950181/5d3a2693-75f9-4c56-9107-8ccaa96785fd" width="1000">
web:dev:
web:dev: Import trace for requested module:
web:dev: ../../node_modules/.pnpm/@libsql+client@0.6.0/node_modules/@libsql/client/README.md
web:dev: ../../node_modules/.pnpm/libsql@0.3.12/node_modules/@libsql/ ../../node_modules/.pnpm/node_modules/@libsql/ ../../node_modules/@libsql/ ../../node_modules/.pnpm/node_modules/@libsql/ ../../node_modules/.pnpm/libsql@0.3.12/node_modules/@libsql/ ../../node_modules/.pnpm/node_modules/@libsql/ ../../node_modules/@libsql/ ../../node_modules/.pnpm/node_modules/@libsql/ sync ^\.\/.*$
web:dev: ../../node_modules/.pnpm/libsql@0.3.12/node_modules/libsql/index.js
web:dev: ../../node_modules/.pnpm/@libsql+client@0.6.0/node_modules/@libsql/client/lib-esm/sqlite3.js
web:dev: ../../node_modules/.pnpm/@libsql+client@0.6.0/node_modules/@libsql/client/lib-esm/node.js
web:dev: ../../packages/db/index.ts
web:dev: ./src/app/page.tsx

  async function addUser () {
    "use server";

    await db.insert(users).values({
      id: nanoid(),
      name: "John Doe",
      email: "[email protected]",
    });
  };

from libsql.

joshxfi avatar joshxfi commented on June 13, 2024

Update: I fixed it by instantiating drizzle on the Next.js project instead of exporting the setup in packages/db.

Before

// packages/db/index.ts

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

const client = createClient({
  url: process.env.TURSO_CONNECTION_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
});

export const db = drizzle(client);

After

// packages/db/index.ts

export * as schema from './schema'
export * from 'drizzle-orm/libsql'
// apps/web/src/lib/drizzle.ts

import 'dotenv/config';
import { drizzle, schema } from '@project/db';
import { createClient } from '@libsql/client';

const client = createClient({
  url: process.env.TURSO_CONNECTION_URL!,
  authToken: process.env.TURSO_AUTH_TOKEN!,
});

export const db = drizzle(client, { schema });

from libsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.