in drizzle.config.ts: "Cannot use import statement outside a module"

happens when I try to push
import type { Config } from "drizzle-kit";
import { env } from "~/env.mjs";

export default {
schema: "./src/db/schema.ts",
host: env.DATABASE_HOST,
user: env.DATABASE_USERNAME,
password: env.DATABASE_PASSWORD,
} satisfies Config;
import type { Config } from "drizzle-kit";
import { env } from "~/env.mjs";

export default {
schema: "./src/db/schema.ts",
host: env.DATABASE_HOST,
user: env.DATABASE_USERNAME,
password: env.DATABASE_PASSWORD,
} satisfies Config;
env.mjs zod validates the raw process.env any assistance is very much appreciated thanks
7 Replies
Maston
Maston2y ago
i think drizzle.config.ts gets compiled to a commonjs module so you cant import .mjs or any es6 modules do you use a env.mjs for using it with a next.config.mjs like in create-t3-app ?
ryanagillie
ryanagillie2y ago
having the same problem here
Andrii Sherman
@alexblokh is working on it Will be included in next drizzle-kit release
ryanagillie
ryanagillie2y ago
ryanagillie
ryanagillie2y ago
Here's my error log if that helps
alexblokh
alexblokh2y ago
with all bells and whistles, it's going to be a cjs bundle for kit with runtime cjs/esm support
ryanagillie
ryanagillie2y ago
those are words yes poohheh
Want results from more Discord servers?
Add your server