drizzle-team / drizzle-team/drizzle-orm
[BUG]: `drizzle-kit` generate fails to resolve imports
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.31.1
### What version of `drizzle-kit` are you using?
0.22.2
### Describe the Bug
Importing another table from another drizzle schema file (both are `sqliteTable()`) using
```ts
import { users as dataspaceUsers } from '../dataspace/index.js';
```
fails unless I remove the `/index.js` like:
```ts
import { users as dataspaceUsers } from '../dataspace';
```
which then works as expected when running `drizzle-kit generate`. But this breaks the schema file when being imported to be used by `drizzle-orm` normally at runtime:
```
Uncaught Error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '\dist\schemas\dataspace' is not supported resolving ES modules imported from \dist\schemas\tenant\index.js
```
which is fixable by keeping the full path:
```ts
import { users as dataspaceUsers } from '../dataspace/index.js';
```
### Expected behavior
I use the
```ts
import { users as dataspaceUsers } from '../dataspace/index.js';
```
and the import resolves as expected both during `drizzle-kit` and `drizzle-orm` runtime
### Environment & setup
`drizzle-kit` is ran using `exec()` inside a node.js script that is ran in GitHub actions as part of overall project ci/cd to do automated migrations.
`drizzle-orm` using that schema is at regular runtime being used either in node.js environment or cloudflare workers environment.
Contributor guide
Assessment
This issue has not been assessed yet.