TSC build error

When i try to build my package with tsc, I get 71 errors, all of which look like this:
../../../node_modules/drizzle-orm/sqlite-core/utils.d.cts:25:56 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.ts")' call instead.

25 query: TExisting extends true ? undefined : import("../index.ts").SQL<unknown>;
../../../node_modules/drizzle-orm/sqlite-core/utils.d.cts:25:56 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.ts")' call instead.

25 query: TExisting extends true ? undefined : import("../index.ts").SQL<unknown>;
Found 71 errors in 24 files.

Errors Files
1 ../../../node_modules/drizzle-orm/mysql-core/db.d.cts:1
1 ../../../node_modules/drizzle-orm/mysql-core/db.d.ts:1
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.cts:36
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.ts:36
7 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.cts:199
7 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.ts:199
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.cts:130
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.ts:130
7 ../../../node_modules/drizzle-orm/mysql-core/utils.d.cts:10
1 ../../../node_modules/drizzle-orm/pg-core/columns/date.common.d.cts:6
1 ../../../node_modules/drizzle-orm/pg-core/query-builders/query.d.cts:23
1 ../../../node_modules/drizzle-orm/pg-core/query-builders/query.d.ts:23
1 ../../../node_modules/drizzle-orm/pg-core/roles.d.cts:7
1 ../../../node_modules/drizzle-orm/pg-core/roles.d.ts:7
13 ../../../node_modules/drizzle-orm/pg-core/utils.d.cts:12...
and so on
Found 71 errors in 24 files.

Errors Files
1 ../../../node_modules/drizzle-orm/mysql-core/db.d.cts:1
1 ../../../node_modules/drizzle-orm/mysql-core/db.d.ts:1
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.cts:36
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/delete.d.ts:36
7 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.cts:199
7 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.d.ts:199
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.cts:130
1 ../../../node_modules/drizzle-orm/mysql-core/query-builders/select.types.d.ts:130
7 ../../../node_modules/drizzle-orm/mysql-core/utils.d.cts:10
1 ../../../node_modules/drizzle-orm/pg-core/columns/date.common.d.cts:6
1 ../../../node_modules/drizzle-orm/pg-core/query-builders/query.d.cts:23
1 ../../../node_modules/drizzle-orm/pg-core/query-builders/query.d.ts:23
1 ../../../node_modules/drizzle-orm/pg-core/roles.d.cts:7
1 ../../../node_modules/drizzle-orm/pg-core/roles.d.ts:7
13 ../../../node_modules/drizzle-orm/pg-core/utils.d.cts:12...
and so on
I am using "drizzle-orm": "^0.36.4", "drizzle-kit": "^0.28.1", with the tsconfig options: "target": "ES2022", "module": "nodenext", "moduleResolution": "nodenext",
1 Reply
Angelelz
Angelelz4w ago
You have to add skipLibCheck: true to your tsconfig
Want results from more Discord servers?
Add your server