Skip to content

[BUG]: drizzle-kit@1.0.0-beta.13 regression in module resolution #5365

@damaafer

Description

@damaafer

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

1.0.0-beta.15

What version of drizzle-kit are you using?

1.0.0-beta.15

Other packages

drizzle-kit@1.0.0-beta.13

Describe the Bug

What is the undesired behavior?
The new way to load modules (with jiti) introduced in drizzle@1.0.0-beta.13 fails to resolve path aliases defined in tsconfig.json

What are the steps to reproduce it

src
├── entities
│   ├── profile
│   │   └── schema.ts
│   ├── user
│   │    └── schema.ts
drizzle.config.ts
tsconfig.json
//tsconfig.json

{
  "compilerOptions": {
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
//drizzle.config.ts

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: ['./src/**/schema.ts'],
  //...
});
//src/entites/profile/schema.ts

import { pgTable } from 'drizzle-orm/pg-core';

export const profile = pgTable('profile', (t) => ({
  id: t.integer().primaryKey().generatedAlwaysAsIdentity()
}));
//src/entites/user/schema.ts
import { pgTable } from "drizzle-orm/pg-core";
import { profile } from "@/entities/profile/schema"; // this import fails  

export const user = pgTable(
  'user',
  (t) => ({
    id: t.integer().primaryKey().generatedAlwaysAsIdentity(),
    profileId: t
      .integer()
      .unique()
      .references(() => profile.id)
      .notNull()
  })
);

drizzle-kit@1.0.0-beta.13+ fails with the folowing error :

> drizzle-kit push
Error  Cannot find module '@/entities/profile/schema'
Require stack:
- /home/damaafer/Workspace/tests/drizzle-kit-bug/src/entities/user/schema.ts

drizzle-kit@1.0.0-beta.12 works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions