Next.js Discord

Discord Forum

Ecmascript file had an error

Unanswered
Britannia Petite posted this in #help-forum
Open in Discord
Britannia PetiteOP
./server/actions/user/customization.ts (1:1)

Ecmascript file had an error
> 1 | "use server";
    | ^^^^^^^^^^^^
  2 |
  3 | import { db } from "@/db/drizzle";
  4 | import { eq } from "drizzle-orm";

The "use server" directive must be at the top of the file.

7 Replies

Britannia PetiteOP
when im editing a client side component
and saving it
this error is being thrown
the error could be because of the exports you have in the file
you might have named a variable starting with use, which is only permitted on React client componentns